summaryrefslogtreecommitdiff
path: root/beos
diff options
context:
space:
mode:
Diffstat (limited to 'beos')
-rw-r--r--beos/beos_filetype.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/beos/beos_filetype.cpp b/beos/beos_filetype.cpp
index 9abee228c..75fe870c8 100644
--- a/beos/beos_filetype.cpp
+++ b/beos/beos_filetype.cpp
@@ -92,6 +92,7 @@ const char *fetch_filetype(const char *unix_path)
{
struct stat statbuf;
status_t err;
+ int i;
// NOT THREADSAFE
static char type[B_MIME_TYPE_LENGTH];
@@ -109,6 +110,18 @@ const char *fetch_filetype(const char *unix_path)
if (err < B_OK)
return "test/plain";
+ // override reading the mime type for known types
+ // avoids getting CSS files as text/x-source-code
+ // even though it's the mime sniffer rules that should be fixed.
+ BString ext(unix_path);
+ ext.Remove(0, ext.FindLast('.') + 1);
+ for (i = 0; default_types[i].type; i++) {
+ if (ext == default_types[i].ext1)
+ return default_types[i].type;
+ if (ext == default_types[i].ext2)
+ return default_types[i].type;
+ }
+
err = info.GetType(type);
if (err < B_OK) {
// not there yet, sniff and retry