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

Unified Diff: net/http/http_content_disposition.cc

Issue 10447019: Prefer 'filename' parameters if both 'name' and 'filename' parameters are specified in a Content-Di… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge only Created 8 years, 7 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 | net/http/http_content_disposition_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_content_disposition.cc
diff --git a/net/http/http_content_disposition.cc b/net/http/http_content_disposition.cc
index 5ec09c94a47e2e7e58c8ab4a805a3d3fa1dd9f74..52d9f4fdf2435e80b4394910d19a8d1ad33c4839 100644
--- a/net/http/http_content_disposition.cc
+++ b/net/http/http_content_disposition.cc
@@ -69,6 +69,7 @@ void HttpContentDisposition::Parse(const std::string& header,
std::string::const_iterator end = header.end();
pos = ConsumeDispositionType(pos, end);
+ std::string name;
std::string filename;
std::string ext_filename;
@@ -78,10 +79,10 @@ void HttpContentDisposition::Parse(const std::string& header,
iter.name_end(),
"filename")) {
DecodeFilenameValue(iter.value(), referrer_charset, &filename);
- } else if (filename.empty() && LowerCaseEqualsASCII(iter.name_begin(),
- iter.name_end(),
- "name")) {
- DecodeFilenameValue(iter.value(), referrer_charset, &filename);
+ } else if (name.empty() && LowerCaseEqualsASCII(iter.name_begin(),
+ iter.name_end(),
+ "name")) {
+ DecodeFilenameValue(iter.value(), referrer_charset, &name);
} else if (ext_filename.empty() && LowerCaseEqualsASCII(iter.name_begin(),
iter.name_end(),
"filename*")) {
@@ -89,7 +90,12 @@ void HttpContentDisposition::Parse(const std::string& header,
}
}
- filename_ = ext_filename.empty() ? filename : ext_filename;
+ if (!ext_filename.empty())
+ filename_ = ext_filename;
+ else if (!filename.empty())
+ filename_ = filename;
+ else
+ filename_ = name;
}
} // namespace net
« no previous file with comments | « no previous file | net/http/http_content_disposition_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698