Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Unified Diff: url/third_party/mozilla/url_parse.cc

Issue 560283003: Wrong filename on file upload (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated comments Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | url/url_parse_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/third_party/mozilla/url_parse.cc
diff --git a/url/third_party/mozilla/url_parse.cc b/url/third_party/mozilla/url_parse.cc
index 62567969a6502b1d5bf4a781e078ca778f462fd9..ba842b87b5db347ccc3bc5f5dccf7472ffc1aa40 100644
--- a/url/third_party/mozilla/url_parse.cc
+++ b/url/third_party/mozilla/url_parse.cc
@@ -621,23 +621,13 @@ void DoExtractFileName(const CHAR* spec,
return;
}
- // Search backwards for a parameter, which is a normally unused field in a
- // URL delimited by a semicolon. We parse the parameter as part of the
- // path, but here, we don't want to count it. The last semicolon is the
- // parameter. The path should start with a slash, so we don't need to check
- // the first one.
+ // Extract the filename range from the path which is between
+ // the last slash and the following semicolon.
int file_end = path.end();
- for (int i = path.end() - 1; i > path.begin; i--) {
+ for (int i = path.end() - 1; i >= path.begin; i--) {
if (spec[i] == ';') {
file_end = i;
- break;
- }
- }
-
- // Now search backwards from the filename end to the previous slash
- // to find the beginning of the filename.
- for (int i = file_end - 1; i >= path.begin; i--) {
- if (IsURLSlash(spec[i])) {
+ } else if (IsURLSlash(spec[i])) {
// File name is everything following this character to the end
*file_name = MakeRange(i + 1, file_end);
return;
« no previous file with comments | « no previous file | url/url_parse_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698