diff --git a/ChangeLog b/ChangeLog index 3bdf8badb..4b695f11d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-12-18 Moritz Bunkus + + * mkvmerge, mmg: bug fix: Automatic MIME type recognition for + TrueType fonts will result in "application/x-truetype-font" again + instead of "application/x-font-ttf". Fix for bug 682. + 2011-12-14 Andriy Bilous'ko * documentation: enhancement: Added a Ukrainian translation for diff --git a/src/common/extern_data.cpp b/src/common/extern_data.cpp index 96316a623..9f2cdfbc5 100644 --- a/src/common/extern_data.cpp +++ b/src/common/extern_data.cpp @@ -2668,9 +2668,9 @@ guess_mime_type_by_content(magic_t &m, } #endif // HAVE_MAGIC_H -std::string -guess_mime_type(std::string ext, - bool is_file) { +static std::string +guess_mime_type_internal(std::string ext, + bool is_file) { #if HAVE_MAGIC_H std::string ret; magic_t m; @@ -2709,9 +2709,6 @@ guess_mime_type(std::string ext, if (ret == "application/octet-stream") ret = guess_mime_type_by_ext(ext); - if (ret == "") - ret = "application/octet-stream"; - return ret; } #else // HAVE_MAGIC_H @@ -2719,6 +2716,20 @@ guess_mime_type(std::string ext, #endif // HAVE_MAGIC_H } +std::string +guess_mime_type(std::string ext, + bool is_file) { + std::string mime_type = guess_mime_type_internal(ext, is_file); + + if (mime_type.empty()) + return "application/octet-stream"; + + else if (mime_type == "application/x-font-ttf") + return "application/x-truetype-font"; + + return mime_type; +} + bool is_valid_cctld(const std::string &s) { int i;