From 13d78d258579a9d071f138b1ca906fbf0ece2039 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Mon, 11 Feb 2008 22:43:19 +0000 Subject: [PATCH] * add our hardcoded mimetypes first, and then fallback to xdgmime. --- libcitadel/lib/mime_parser.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libcitadel/lib/mime_parser.c b/libcitadel/lib/mime_parser.c index 0da90aeb0..56cd0b0d6 100644 --- a/libcitadel/lib/mime_parser.c +++ b/libcitadel/lib/mime_parser.c @@ -681,8 +681,6 @@ MimeGuess MyMimes [] = { const char *GuessMimeType(char *data, size_t dlen) { - return (xdg_mime_get_mime_type_for_data(data, dlen)); -/* int MimeIndex = 0; while (MyMimes[MimeIndex].PatternLen != 0) @@ -693,19 +691,21 @@ const char *GuessMimeType(char *data, size_t dlen) &data[MyMimes[MimeIndex].PatternOffset], MyMimes[MimeIndex].PatternLen) == 0) { - break; + return MyMimes[MimeIndex].MimeString; } MimeIndex ++; } - return MyMimes[MimeIndex].MimeString; -*/ + /* + * ok, our simple minded algorythm didn't find anything, + * let the big chegger try it, he wil default to application/octet-stream + */ + return (xdg_mime_get_mime_type_for_data(data, dlen)); } const char* GuessMimeByFilename(const char *what, size_t len) { - return xdg_mime_get_mime_type_from_file_name(what); -/* + /* we know some hardcoded on our own, try them... */ if (!strncasecmp(&what[len - 4], ".gif", 4)) return "image/gif"; else if (!strncasecmp(&what[len - 3], ".js", 3)) @@ -735,6 +735,6 @@ const char* GuessMimeByFilename(const char *what, size_t len) else if (!strncasecmp(&what[len - 5], ".wbmp", 5)) return "image/vnd.wap.wbmp"; else - return "application/octet-stream"; -*/ + /* and let xdgmime do the fallback. */ + return xdg_mime_get_mime_type_from_file_name(what); } -- 2.39.2