summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-16 06:54:06 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-16 06:54:06 +0000
commit449c5e76fcd8fc265b4be054d3783d63648ed6e0 (patch)
treede3e19addd2366ed8048ef4928144938976b47ff /net
parent21f2af76e9c48031a17365548d6058a8baa6bdff (diff)
downloadchromium_src-449c5e76fcd8fc265b4be054d3783d63648ed6e0.zip
chromium_src-449c5e76fcd8fc265b4be054d3783d63648ed6e0.tar.gz
chromium_src-449c5e76fcd8fc265b4be054d3783d63648ed6e0.tar.bz2
Override .ico file's mime type on Linux. XDG's mime database has a bogus "image/x-ico" entry whereas the rest of the world uses "image/x-icon".
TBR=estade Review URL: http://codereview.chromium.org/115440 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16231 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/platform_mime_util_linux.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/net/base/platform_mime_util_linux.cc b/net/base/platform_mime_util_linux.cc
index acc14dc..2afdc47 100644
--- a/net/base/platform_mime_util_linux.cc
+++ b/net/base/platform_mime_util_linux.cc
@@ -14,10 +14,20 @@ bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension(
const FilePath::StringType& ext, std::string* result) const {
FilePath::StringType dummy_path = "foo." + ext;
std::string out = mime_util::GetFileMimeType(dummy_path);
+
// GetFileMimeType likes to return application/octet-stream
// for everything it doesn't know - ignore that.
if (out == "application/octet-stream" || !out.length())
return false;
+
+ // GetFileMimeType returns image/x-ico because that's what's in the XDG
+ // mime database. That database is the merger of the Gnome and KDE mime
+ // databases. Apparently someone working on KDE in 2001 decided .ico
+ // resolves to image/x-ico, whereas the rest of the world uses image/x-icon.
+ // FWIW, image/vnd.microsoft.icon is the official IANA assignment.
+ if (out == "image/x-ico")
+ out = "image/x-icon";
+
*result = out;
return true;
}