summaryrefslogtreecommitdiff
path: root/beos/beos_filetype.cpp
diff options
context:
space:
mode:
authorFran├žois Revel <mmu_man@netsurf-browser.org>2008-10-08 22:05:11 +0000
committerFran├žois Revel <mmu_man@netsurf-browser.org>2008-10-08 22:05:11 +0000
commit54013eb1fae2de815e7036e161089e691136fa42 (patch)
treef42b736d0290763c7a6e8f57f1a51f6a78591437 /beos/beos_filetype.cpp
parent8b992259f1e952f3856a6af37224c5db55540580 (diff)
downloadnetsurf-54013eb1fae2de815e7036e161089e691136fa42.tar.gz
netsurf-54013eb1fae2de815e7036e161089e691136fa42.tar.bz2
Override checking the mime type for known extensions. At least on my system, the mime sniffer thinks css files are text/x-source-code, and NS didn't like that.
svn path=/trunk/netsurf/; revision=5509
Diffstat (limited to 'beos/beos_filetype.cpp')
-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