From b3b05e31863f9488833f7ee3e8dee341edb9a6cb Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sat, 30 Jun 2007 09:53:55 +0000 Subject: [PATCH] 1. MIME type detection: If libmagic returns "application/octet-stream" then try auto-detecting via the file name extension. 2. Added the extension "otf" for OpenType fonts (MIME type the same as TrueType fonts). Fix for bug 242. --- src/common/extern_data.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/common/extern_data.cpp b/src/common/extern_data.cpp index df046cb1d..e1268422b 100644 --- a/src/common/extern_data.cpp +++ b/src/common/extern_data.cpp @@ -2132,7 +2132,7 @@ const mime_type_t mime_types[] = { {"application/x-troff-man", "man"}, {"application/x-troff-me", "me"}, {"application/x-troff-ms", "ms"}, - {"application/x-truetype-font", "ttf"}, + {"application/x-truetype-font", "ttf otf"}, {"application/x-ustar", "ustar"}, {"application/x-wais-source", "src"}, {"application/x-wingz", "wz"}, @@ -2653,6 +2653,13 @@ guess_mime_type(string ext, int idx = ret.find(';'); if (-1 != idx) ret.erase(idx); + + if (ret == "application/octet-stream") + ret = guess_mime_type_by_ext(ext); + + if (ret == "") + ret = "application/octet-stream"; + return ret; } #else