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

Unified Diff: net/base/net_util.cc

Issue 297003: Implement URLRequestDataJob (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 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 | net/base/net_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_util.cc
===================================================================
--- net/base/net_util.cc (revision 29390)
+++ net/base/net_util.cc (working copy)
@@ -1036,6 +1036,18 @@
const std::string& content_disposition,
const std::string& referrer_charset,
const std::wstring& default_name) {
+ // TODO(rolandsteiner): as pointed out by darin in the code review, this is
+ // hardly ideal. "download" should be translated, or another solution found.
+ // (cf. http://code.google.com/p/chromium/issues/detail?id=25289)
+ const wchar_t kFinalFallbackName[] = L"download";
+
+ // about: and data: URLs don't have file names, but esp. data: URLs may
+ // contain parts that look like ones (i.e., contain a slash).
+ // Therefore we don't attempt to divine a file name out of them.
+ if (url.SchemeIs("about") || url.SchemeIs("data"))
+ return default_name.empty() ? std::wstring(kFinalFallbackName)
+ : default_name;
+
std::wstring filename = GetFileNameFromCD(content_disposition,
referrer_charset);
if (!filename.empty()) {
@@ -1065,7 +1077,8 @@
// Some schemes (e.g. file) do not have a hostname. Even though it's
// not likely to reach here, let's hardcode the last fallback name.
// TODO(jungshik) : Decode a 'punycoded' IDN hostname. (bug 1264451)
- filename = url.host().empty() ? L"download" : UTF8ToWide(url.host());
+ filename = url.host().empty() ? std::wstring(kFinalFallbackName)
+ : UTF8ToWide(url.host());
} else {
NOTREACHED();
}
« no previous file with comments | « no previous file | net/base/net_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698