mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-24 07:19:37 +03:00
Make fetch_mimetype consider our internal mapping table
svn path=/trunk/netsurf/; revision=2894
This commit is contained in:
parent
978637a134
commit
358f20f4cd
@ -152,6 +152,7 @@ char *fetch_mimetype(const char *ro_path)
|
||||
int objtype;
|
||||
char *mime = calloc(BUF_SIZE, sizeof(char));
|
||||
char *slash;
|
||||
struct type_entry *t;
|
||||
|
||||
if (!mime) {
|
||||
LOG(("Insufficient memory for calloc"));
|
||||
@ -193,6 +194,16 @@ char *fetch_mimetype(const char *ro_path)
|
||||
filetype = load;
|
||||
}
|
||||
|
||||
/* search for MIME type in our internal table */
|
||||
t = bsearch(&filetype, type_map, TYPE_MAP_COUNT,
|
||||
sizeof(type_map[0]), cmp_type);
|
||||
if (t) {
|
||||
/* found, so return it */
|
||||
strncpy(mime, t->mime_type, BUF_SIZE);
|
||||
return mime;
|
||||
}
|
||||
|
||||
/* not in internal table, so ask MimeMap */
|
||||
e = xmimemaptranslate_filetype_to_mime_type(filetype, mime);
|
||||
if (e) {
|
||||
LOG(("xmimemaptranslate_filetype_to_mime_type: 0x%x: %s",
|
||||
|
Loading…
Reference in New Issue
Block a user