Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a query string parsing problem happend to PDF Viewer #10008

Merged
merged 4 commits into from Jul 18, 2017
Merged

Fix a query string parsing problem happend to PDF Viewer #10008

merged 4 commits into from Jul 18, 2017

Conversation

qazbnm456
Copy link
Contributor

This PR should resolve #10007.

@kevinsawicki
Copy link
Contributor

Would it be possible to add a new spec for this as well?

Copy link
Member

@deepak1556 deepak1556 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requires a few minor fixes, LGTM otherwise. Thanks @qazbnm456 !

@@ -86,9 +86,10 @@ void OnPdfResourceIntercepted(
// The URL passes the original pdf resource url, that will be requested
// by the webui page.
// chrome://pdf-viewer/index.html?src=https://somepage/123.pdf
GURL escaped_url(net::EscapeUrlEncodedData(original_url.spec(), true));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Result of net::EscapeUrlEncodedData can be used directly in the final url creation below, escaped_url GURL is not required.

  • the use_plus parameter should be invoked with false, since we use net::UnescapeRule::SPACES below.

@@ -52,9 +53,16 @@ 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 =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SPOOFING_AND_CONTROL_CHARS should be avoided. Also NORMAL rule need not be specified, any rule specified includes the normal rule by default.

@qazbnm456
Copy link
Contributor Author

@kevinsawicki I'll see if I can figure out a way to add a new spec for this!
@deepak1556 Changes added. Thanks for your suggestions.

@qazbnm456
Copy link
Contributor Author

qazbnm456 commented Jul 15, 2017

@kevinsawicki A new spec has been added, and all checks have been passed as well. 😃

@kevinsawicki
Copy link
Contributor

A new spec has been added, and all checks have been passed as well. 😃

👍 Thanks for fixing this 🚢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot open the PDF file with the ampersand symbol existed in the url.
3 participants