[project @ 2004-03-21 22:31:30 by jmb]

Fix mimetype reading for files used by image filingsystems.

svn path=/import/netsurf/; revision=647
This commit is contained in:
John Mark Bell 2004-03-21 22:31:30 +00:00
parent 7e922c290f
commit dc642bc3fa
1 changed files with 12 additions and 2 deletions

View File

@ -79,12 +79,22 @@ const char *fetch_filetype(const char *unix_path)
char *fetch_mimetype(const char *ro_path) {
os_error *e;
bits filetype;
bits filetype = 0, load;
int objtype;
char *mime = xcalloc(256, sizeof(char));
e = xosfile_read_stamped_no_path(ro_path, 0, 0, 0, 0, 0, &filetype);
e = xosfile_read_no_path(ro_path, &objtype, &load, 0, 0, 0);
if (e) return 0;
if (objtype == 0x2) return 0; /* directories are pointless */
if ((load >> 20) & 0xFFF) {
filetype = (load>>8) & 0x000FFF;
}
else {
return 0; /* no idea */
}
e = xmimemaptranslate_filetype_to_mime_type(filetype, mime);
if (e) return 0;