summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-30 17:19:27 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-30 17:19:27 +0000
commitc43270786ed2a06b7717fbfc203cf76ec532dd1d (patch)
tree945813e2bb358accb06ffe76c2d21fb8d70c8af1
parent2c3cdcacdd24d132892fc0df9ff2966527fba019 (diff)
downloadchromium_src-c43270786ed2a06b7717fbfc203cf76ec532dd1d.zip
chromium_src-c43270786ed2a06b7717fbfc203cf76ec532dd1d.tar.gz
chromium_src-c43270786ed2a06b7717fbfc203cf76ec532dd1d.tar.bz2
Make chrome aware of text/x-sh mime type.
Map it to .sh, also mark it as executable. Either one of these fixes alone would take care of this bug, but 2 fixes are better than 1! BUG=56855 TEST=manual (see bug) Review URL: http://codereview.chromium.org/3557003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61075 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/download/download_exe.cc1
-rw-r--r--chrome/browser/download/download_util_unittest.cc11
-rw-r--r--net/base/platform_mime_util_linux.cc9
3 files changed, 15 insertions, 6 deletions
diff --git a/chrome/browser/download/download_exe.cc b/chrome/browser/download/download_exe.cc
index 2ceab73..e8d42f6 100644
--- a/chrome/browser/download/download_exe.cc
+++ b/chrome/browser/download/download_exe.cc
@@ -202,6 +202,7 @@ static const char* kExecutableWhiteList[] = {
// Registry files can cause critical changes to the MS OS behavior.
// Addition of this mimetype also addresses bug 7337.
"text/x-registry",
+ "text/x-sh",
// Some sites use binary/octet-stream to mean application/octet-stream.
// See http://code.google.com/p/chromium/issues/detail?id=1573
"binary/octet-stream"
diff --git a/chrome/browser/download/download_util_unittest.cc b/chrome/browser/download/download_util_unittest.cc
index d257174..823826e 100644
--- a/chrome/browser/download/download_util_unittest.cc
+++ b/chrome/browser/download/download_util_unittest.cc
@@ -428,6 +428,13 @@ const struct {
"http://www.example.com/.download.txt",
"text/plain",
L"download.txt"},
+
+ // Issue=56855.
+ {"",
+ "http://www.example.com/bar.sh",
+ "application/x-sh",
+ L"bar.sh"
+ },
};
// Tests to ensure that the file names we generate from hints from the server
@@ -527,7 +534,7 @@ const struct {
{ FILE_PATH_LITERAL("C:\\foo\\con"),
"text/html",
FILE_PATH_LITERAL("C:\\foo\\_con.htm") },
-#else
+#else // !defined(OS_WIN)
{ FILE_PATH_LITERAL("/foo/bar.htm"),
"text/html",
FILE_PATH_LITERAL("/foo/bar.htm") },
@@ -563,7 +570,7 @@ const struct {
{ FILE_PATH_LITERAL("/foo/con"),
"text/html",
FILE_PATH_LITERAL("/foo/con.html") },
-#endif // OS_WIN
+#endif // !defined(OS_WIN)
};
TEST(DownloadUtilTest, GenerateSafeFileName) {
diff --git a/net/base/platform_mime_util_linux.cc b/net/base/platform_mime_util_linux.cc
index b39fe27..d407448 100644
--- a/net/base/platform_mime_util_linux.cc
+++ b/net/base/platform_mime_util_linux.cc
@@ -44,16 +44,17 @@ struct MimeToExt {
};
const struct MimeToExt mime_type_ext_map[] = {
+ {"application/pdf", "pdf"},
+ {"application/x-tar", "tar"},
+ {"audio/mpeg", "mp3"},
+ {"image/gif", "gif"},
{"image/jpeg", "jpg"},
{"image/png", "png"},
- {"image/gif", "gif"},
{"text/html", "html"},
{"video/mp4", "mp4"},
{"video/mpeg", "mpg"},
- {"audio/mpeg", "mp3"},
{"text/plain", "txt"},
- {"application/pdf", "pdf"},
- {"application/x-tar", "tar"}
+ {"text/x-sh", "sh"},
};
bool PlatformMimeUtil::GetPreferredExtensionForMimeType(