Return "application/x-truetype-font" for TrueType font MIME type recognition

Fix for bug 682.
This commit is contained in:
Moritz Bunkus 2011-12-18 15:21:37 +01:00
parent 28087bcb58
commit 2813d12ae9
2 changed files with 23 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2011-12-18 Moritz Bunkus <moritz@bunkus.org>
* 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 <arestarh@ukr.net>
* documentation: enhancement: Added a Ukrainian translation for

View File

@ -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;