33#include < include/cef_parser.h>
44
55#include " browser-scheme.hpp"
6+ #include " obs.h"
67
78
89BrowserSchemeHandlerFactory::BrowserSchemeHandlerFactory ()
@@ -33,18 +34,20 @@ bool BrowserSchemeHandler::ProcessRequest(CefRefPtr<CefRequest> request,
3334 CefURLParts parts;
3435 CefParseURL (request->GetURL (), parts);
3536
36- std::string path = CefString (&parts.path );
37-
38- // Set fileName for use in GetResponseHeaders
39- fileName = path;
37+ std::wstring path = CefString (&parts.path );
4038
4139 path = CefURIDecode (path, true , cef_uri_unescape_rule_t ::UU_SPACES);
42- path = CefURIDecode (path, true , cef_uri_unescape_rule_t ::UU_NORMAL );
40+ path = CefURIDecode (path, true , cef_uri_unescape_rule_t ::UU_URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS );
4341#ifdef WIN32
42+ // blog(LOG_INFO, "%s", path.erase(0,1));
4443 inputStream.open (path.erase (0 ,1 ), std::ifstream::binary);
4544#else
4645 inputStream.open (path, std::ifstream::binary);
4746#endif
47+
48+ // Set fileName for use in GetResponseHeaders
49+ fileName = path;
50+
4851 if (!inputStream.is_open ()) {
4952 callback->Cancel ();
5053 return false ;
@@ -66,11 +69,11 @@ void BrowserSchemeHandler::GetResponseHeaders(CefRefPtr<CefResponse> response,
6669 return ;
6770 }
6871
69- std::string fileExtension = fileName.substr (
70- fileName.find_last_of (" ." ) + 1 );
72+ std::wstring fileExtension = fileName.substr (
73+ fileName.find_last_of (L " ." ) + 1 );
7174
72- if (fileExtension == " woff2 " ) {
73- fileExtension = " woff" ;
75+ if (fileExtension. compare ( L" woff2 " ) == 0 ) {
76+ fileExtension = L " woff" ;
7477 }
7578
7679 std::transform (fileExtension.begin (), fileExtension.end (),
0 commit comments