Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
Handle file:// with net::FileProtocolHandler and don't covert brave://
Browse files Browse the repository at this point in the history
to file://

credit the patch to @bridiver

fix brave/browser-laptop#14642

Auditor: @bridiver, @diracdeltas
  • Loading branch information
darkdh committed Jul 6, 2018
1 parent c59eec1 commit 845d425
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion atom/browser/atom_browser_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "content/public/common/url_constants.h"
#include "net/ftp/ftp_network_layer.h"
#include "net/url_request/data_protocol_handler.h"
#include "net/url_request/file_protocol_handler.h"
#include "net/url_request/ftp_protocol_handler.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_intercepting_job_factory.h"
Expand Down Expand Up @@ -89,9 +90,15 @@ AtomBrowserContext::CreateURLRequestJobFactory(
url::kDataScheme, base::WrapUnique(new net::DataProtocolHandler));
job_factory->SetProtocolHandler(
url::kFileScheme,
std::make_unique<net::FileProtocolHandler>(
base::CreateTaskRunnerWithTraits(
{base::MayBlock(), base::TaskPriority::USER_VISIBLE,
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN})));
job_factory->SetProtocolHandler(
"brave",
base::WrapUnique(
new asar::AsarProtocolHandler(base::CreateTaskRunnerWithTraits(
{base::MayBlock(), base::TaskPriority::USER_BLOCKING,
{base::MayBlock(), base::TaskPriority::USER_VISIBLE,
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}))));
job_factory->SetProtocolHandler(
url::kHttpScheme,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class BraveDataSource : public content::URLDataSource,
const std::string& path,
const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
const GotDataCallback& callback) override {
GURL url = GURL("file:///" + path);
GURL url = GURL("brave:///" + path);
if (!url.is_valid()) {
DLOG(WARNING) << "Invalid webui resource: brave://" << path;
callback.Run(
Expand Down

0 comments on commit 845d425

Please sign in to comment.