diff options
-rw-r--r-- | chrome/browser/download/download_util.cc | 9 | ||||
-rw-r--r-- | chrome/browser/download/download_util_unittest.cc | 6 |
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", |