Downloading a file with ".tar.bz" extension mulitple times resulted in incorrect filename where ordinal number was suffixed to "tar" instead of filename as below.
Actual - file.tar(1).bz
Expected - file(1).tar.bz
This happened because "bz" was not recognized as double extension.
BUG=116972
Review URL: https://codereview.chromium.org/630323003
Cr-Commit-Position: refs/heads/master@{#298789}
CrOS-Libchrome-Original-Commit: fad66c3012d0c95b447f5bc46da7602f57188dfe
diff --git a/base/files/file_path.cc b/base/files/file_path.cc
index ebc2d6d4..11bf69d 100644
--- a/base/files/file_path.cc
+++ b/base/files/file_path.cc
@@ -35,7 +35,7 @@
namespace {
-const char* kCommonDoubleExtensionSuffixes[] = { "gz", "z", "bz2" };
+const char* kCommonDoubleExtensionSuffixes[] = { "gz", "z", "bz2", "bz" };
const char* kCommonDoubleExtensions[] = { "user.js" };
const FilePath::CharType kStringTerminator = FILE_PATH_LITERAL('\0');
diff --git a/base/files/file_path_unittest.cc b/base/files/file_path_unittest.cc
index 906d8df..956faea 100644
--- a/base/files/file_path_unittest.cc
+++ b/base/files/file_path_unittest.cc
@@ -765,6 +765,7 @@
{ FPL("/foo.tar.gz.gz"), FPL(".gz.gz") },
{ FPL("/foo.1234.user.js"), FPL(".user.js") },
{ FPL("foo.user.js"), FPL(".user.js") },
+ { FPL("/foo.tar.bz"), FPL(".tar.bz") },
};
for (unsigned int i = 0; i < arraysize(cases); ++i) {
FilePath path(cases[i].input);