summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
}