summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorjschuh@google.com <jschuh@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-03 01:57:38 +0000
committerjschuh@google.com <jschuh@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-03 01:57:38 +0000
commit223c449d19eb5d889bc828e011c1a23e5d52b4c9 (patch)
treece4ae0a09ff459b9514ef82819f737c9229d802c /net
parentc1d1958834699761bf8e122a8325ec66fdce59e9 (diff)
downloadchromium_src-223c449d19eb5d889bc828e011c1a23e5d52b4c9.zip
chromium_src-223c449d19eb5d889bc828e011c1a23e5d52b4c9.tar.gz
chromium_src-223c449d19eb5d889bc828e011c1a23e5d52b4c9.tar.bz2
Handle CreateFile() trimming trailing dots and spaces in downloads.
BUG=37007 TEST=unit_tests --gtest_filter=DownloadManagerTest.* Review URL: http://codereview.chromium.org/660297 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40479 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/net_util.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index a2eb04d..124dead 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -1080,6 +1080,16 @@ FilePath GetSuggestedFilename(const GURL& url,
}
}
+#if defined(OS_WIN)
+ { // Handle CreateFile() stripping trailing dots and spaces on filenames
+ // http://support.microsoft.com/kb/115827
+ std::string::size_type pos = filename.find_last_not_of(L" .");
+ if (pos == std::string::npos)
+ filename.resize(0);
+ else
+ filename.resize(++pos);
+ }
+#endif
// Trim '.' once more.
TrimString(filename, FILE_PATH_LITERAL("."), &filename);