Merge pull request #10008 from qazbnm456/fix-pdf-viewer
Fix a query string parsing problem happend to PDF Viewer
This commit is contained in:
commit
1d9f69e742
3 changed files with 40 additions and 3 deletions
|
@ -87,8 +87,11 @@ void OnPdfResourceIntercepted(
|
|||
// by the webui page.
|
||||
// chrome://pdf-viewer/index.html?src=https://somepage/123.pdf
|
||||
content::NavigationController::LoadURLParams params(
|
||||
GURL(base::StringPrintf("%sindex.html?%s=%s", kPdfViewerUIOrigin,
|
||||
kPdfPluginSrc, original_url.spec().c_str())));
|
||||
GURL(base::StringPrintf(
|
||||
"%sindex.html?%s=%s",
|
||||
kPdfViewerUIOrigin,
|
||||
kPdfPluginSrc,
|
||||
net::EscapeUrlEncodedData(original_url.spec(), false).c_str())));
|
||||
web_contents->GetController().LoadURLWithParams(params);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "net/base/escape.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
|
@ -52,9 +53,15 @@ AtomWebUIControllerFactory::CreateWebUIControllerForURL(content::WebUI* web_ui,
|
|||
base::StringPairs toplevel_params;
|
||||
base::SplitStringIntoKeyValuePairs(url.query(), '=', '&', &toplevel_params);
|
||||
std::string stream_id, src;
|
||||
|
||||
const net::UnescapeRule::Type unescape_rules =
|
||||
net::UnescapeRule::SPACES | net::UnescapeRule::PATH_SEPARATORS |
|
||||
net::UnescapeRule::URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS |
|
||||
net::UnescapeRule::REPLACE_PLUS_WITH_SPACE;
|
||||
|
||||
for (const auto& param : toplevel_params) {
|
||||
if (param.first == kPdfPluginSrc) {
|
||||
src = param.second;
|
||||
src = net::UnescapeURLComponent(param.second, unescape_rules);
|
||||
}
|
||||
}
|
||||
if (url.has_ref()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue