summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-28 00:48:22 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-28 00:48:22 +0000
commit9117fb714da99c44319cc8e56909d0a48bf7da02 (patch)
tree5d368ab3aab00cd5220a35a86a790b0fac11be02 /chrome
parentcc14c927a92a73cf31a2c041c71ce235fda71a1c (diff)
downloadchromium_src-9117fb714da99c44319cc8e56909d0a48bf7da02.zip
chromium_src-9117fb714da99c44319cc8e56909d0a48bf7da02.tar.gz
chromium_src-9117fb714da99c44319cc8e56909d0a48bf7da02.tar.bz2
Expand tar.gz download workaround to work for tgz as well.
BUG=52250 TEST=included Review URL: http://codereview.chromium.org/3173048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57760 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/download/download_util.cc9
-rw-r--r--chrome/browser/download/download_util_unittest.cc6
2 files changed, 11 insertions, 4 deletions
diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc
index e7f75c9..0ec1c29 100644
--- a/chrome/browser/download/download_util.cc
+++ b/chrome/browser/download/download_util.cc
@@ -186,8 +186,8 @@ void GenerateExtension(const FilePath& file_name,
// an executable is hidden in a benign file extension;
// E.g. my-cat.jpg becomes my-cat.jpg.js if content type is
// application/x-javascript.
- // 4. New extension is not ".tar" for .tar.gz files. For misconfigured web
- // servers, i.e. bug 5772.
+ // 4. New extension is not ".tar" for .tar.gz/tgz files. For misconfigured
+ // web servers, i.e. bug 5772.
// 5. The original extension is not ".tgz" & the new extension is not "gz".
FilePath::StringType append_extension;
if (net::GetPreferredExtensionForMimeType(mime_type, &append_extension)) {
@@ -196,8 +196,9 @@ void GenerateExtension(const FilePath& file_name,
!IsExecutableExtension(append_extension) &&
!(append_extension == FILE_PATH_LITERAL("gz") &&
extension == FILE_PATH_LITERAL("tgz")) &&
- (append_extension != FILE_PATH_LITERAL("tar") ||
- extension != FILE_PATH_LITERAL("tar.gz"))) {
+ !(append_extension == FILE_PATH_LITERAL("tar") &&
+ (extension == FILE_PATH_LITERAL("tar.gz") ||
+ extension == FILE_PATH_LITERAL("tgz")))) {
extension += FILE_PATH_LITERAL(".");
extension += append_extension;
}
diff --git a/chrome/browser/download/download_util_unittest.cc b/chrome/browser/download/download_util_unittest.cc
index 98064e4..158256b 100644
--- a/chrome/browser/download/download_util_unittest.cc
+++ b/chrome/browser/download/download_util_unittest.cc
@@ -417,6 +417,12 @@ const struct {
"application/x-tar",
L"foo.tar.gz"},
+ // Issue=52250.
+ {"",
+ "http://www.example.com/foo.tgz",
+ "application/x-tar",
+ L"foo.tgz"},
+
// Issue=7337.
{"",
"http://maged.lordaeron.org/blank.reg",