Skip to content

Commit a6c9fb2

Browse files
committed
Transform app url to file url in app protocol handler
Fix nwjs#990; Or the host name will be treated as network share host name
1 parent 45698bf commit a6c9fb2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/net/app_protocol_handler.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ AppProtocolHandler::AppProtocolHandler(const base::FilePath& root)
2222
URLRequestJob* AppProtocolHandler::MaybeCreateJob(
2323
URLRequest* request, NetworkDelegate* network_delegate) const {
2424
base::FilePath file_path;
25-
const bool is_file = FileURLToFilePath(request->url(), &file_path);
25+
GURL url(request->url());
26+
url_canon::Replacements<char> replacements;
27+
replacements.SetScheme("file", url_parse::Component(0, 4));
28+
replacements.ClearHost();
29+
url = url.ReplaceComponents(replacements);
30+
31+
const bool is_file = FileURLToFilePath(url, &file_path);
2632

2733
file_path = root_path_.Append(file_path);
2834
// Check file access permissions.

0 commit comments

Comments
 (0)