|
|
Chromium Code Reviews
DescriptionDecode url in save package download.
Save package does not decode the url when the web content has no title.
Also add some unit tests for special characters.
BUG=654591
Review-Url: https://codereview.chromium.org/2595753002
Cr-Commit-Position: refs/heads/master@{#442710}
Committed: https://chromium.googlesource.com/chromium/src/+/0d4d0fd0973238c92bbd629960eeed5b3481b48c
Patch Set 1 #Patch Set 2 : Just decode the url, and new unit test. #
Total comments: 6
Patch Set 3 : Change back to use net::GenerateFileName #Patch Set 4 : Removes unused include. #Patch Set 5 : Use AsUtf8Unsafe to fix an issue on windows. #
Total comments: 1
Messages
Total messages: 39 (32 generated)
Description was changed from ========== Decode url in save package code. Save package does not decode the url when the web content has no title. This involves URL decode and decode with OS's charset from a path name into a base::string16. Now use net::GenerateFileName to do this, it also santizes the user input. BUG=654591 ========== to ========== Decode url in save package download. Save package does not decode the url when the web content has no title. This involves URL decode and decode with OS's charset from a path name into a base::string16. Now use net::GenerateFileName to do this, it also santizes the user input. BUG=654591 ==========
Description was changed from ========== Decode url in save package download. Save package does not decode the url when the web content has no title. This involves URL decode and decode with OS's charset from a path name into a base::string16. Now use net::GenerateFileName to do this, it also santizes the user input. BUG=654591 ========== to ========== Decode url in save package download. Save package does not decode the url when the web content has no title. This involves URL decode and decode with OS's charset from a path name into a base::string16. Now use net::GenerateFileName to do this, it also santizes the user input. BUG=654591 ==========
The CQ bit was checked by xingliu@chromium.org to run a CQ dry run
xingliu@chromium.org changed reviewers: + dtrainor@chromium.org
Fix the ✰✰✰.txt bug..
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
xingliu@chromium.org changed reviewers: + asanka@chromium.org
asanka@chromium.org: Please help take a look.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: android_n5x_swarming_rel on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_n5x_...)
Description was changed from ========== Decode url in save package download. Save package does not decode the url when the web content has no title. This involves URL decode and decode with OS's charset from a path name into a base::string16. Now use net::GenerateFileName to do this, it also santizes the user input. BUG=654591 ========== to ========== Decode url in save package download. Save package does not decode the url when the web content has no title. Also add some unit tests for special characters. BUG=654591 ==========
The CQ bit was checked by xingliu@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by xingliu@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
https://codereview.chromium.org/2595753002/diff/20001/content/browser/downloa... File content/browser/download/save_package.cc (right): https://codereview.chromium.org/2595753002/diff/20001/content/browser/downloa... content/browser/download/save_package.cc:1267: page_url.path(), "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); Can you check if GURL::ExtractFilename() gives us what we want instead of rewriting all this logic? Oh actually, can you check if net::GenerateFileName() gives us a usable filename from the URL? If so, we can eliminate this entire block. https://codereview.chromium.org/2595753002/diff/20001/content/browser/downloa... content/browser/download/save_package.cc:1276: url_path = page_url.host(); Should call url_formatter::IDNToUnicode() on this, otherwise punicode hostnames will show up wrong. Can you add an IDN hostname to the tests to make sure we are handling those correctly? https://codereview.chromium.org/2595753002/diff/20001/content/browser/downloa... content/browser/download/save_package.cc:1278: url_path = net::UnescapeURLComponent( This shouldn't be called on the hostname (if we end up using it). If ExtractFilename() gives us a non-empty string, we should be able to safely unescape it.
The CQ bit was checked by xingliu@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Thanks for the feedback. Change to use net::GenerateFileName, and try to decode punycode if it uses host name. https://codereview.chromium.org/2595753002/diff/20001/content/browser/downloa... File content/browser/download/save_package.cc (right): https://codereview.chromium.org/2595753002/diff/20001/content/browser/downloa... content/browser/download/save_package.cc:1267: page_url.path(), "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); On 2016/12/22 19:38:43, asanka wrote: > Can you check if GURL::ExtractFilename() gives us what we want instead of > rewriting all this logic? > > Oh actually, can you check if net::GenerateFileName() gives us a usable filename > from the URL? If so, we can eliminate this entire block. Done, net::GenerateFileName() can and it also decodes url-encoding, also add logic to decode punycode in the host name. https://codereview.chromium.org/2595753002/diff/20001/content/browser/downloa... content/browser/download/save_package.cc:1276: url_path = page_url.host(); On 2016/12/22 19:38:43, asanka wrote: > Should call url_formatter::IDNToUnicode() on this, otherwise punicode hostnames > will show up wrong. > > Can you add an IDN hostname to the tests to make sure we are handling those > correctly? Done. Current code doesn't decode punycode. https://codereview.chromium.org/2595753002/diff/20001/content/browser/downloa... content/browser/download/save_package.cc:1278: url_path = net::UnescapeURLComponent( On 2016/12/22 19:38:43, asanka wrote: > This shouldn't be called on the hostname (if we end up using it). If > ExtractFilename() gives us a non-empty string, we should be able to safely > unescape it. Done. convert to net::GenerateFileName().
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: win_chromium_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_...)
The CQ bit was checked by xingliu@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
lgtm For future reference, it's okay to ping on IM or somesuch after a day of not hearing back about a code review. https://codereview.chromium.org/2595753002/diff/80001/content/browser/downloa... File content/browser/download/save_package.cc (right): https://codereview.chromium.org/2595753002/diff/80001/content/browser/downloa... content/browser/download/save_package.cc:1270: if (name_with_proper_ext.AsUTF8Unsafe() == page_url.host()) { Darn. This should really go in //net/base, but //net currently doesn't depend on //components/url_formatter. Adding that dependency would create a cycle in our DEPS :-(. I guess we'll leave it here for now.
The CQ bit was checked by xingliu@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: android_n5x_swarming_rel on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_n5x_...)
The CQ bit was checked by xingliu@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch.
Bot data: {"patchset_id": 80001, "attempt_start_ts": 1484084703848190,
"parent_rev": "0637efffc148042848a1b1977668e42c2a73e5b2", "commit_rev":
"0d4d0fd0973238c92bbd629960eeed5b3481b48c"}
Message was sent while issue was closed.
Description was changed from ========== Decode url in save package download. Save package does not decode the url when the web content has no title. Also add some unit tests for special characters. BUG=654591 ========== to ========== Decode url in save package download. Save package does not decode the url when the web content has no title. Also add some unit tests for special characters. BUG=654591 Review-Url: https://codereview.chromium.org/2595753002 Cr-Commit-Position: refs/heads/master@{#442710} Committed: https://chromium.googlesource.com/chromium/src/+/0d4d0fd0973238c92bbd629960ee... ==========
Message was sent while issue was closed.
Committed patchset #5 (id:80001) as https://chromium.googlesource.com/chromium/src/+/0d4d0fd0973238c92bbd629960ee... |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
