Is it possible to rebuild file types (mime.types)?
| Project: | File Server |
| Version: | 6.x-1.0-alpha3 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Hey guys,
I've had a few issues related to mime type detection and (I think) webdav. Using webdav on winXP to upload .pdfs caused there to be a lack of mime data associated with the file.
I had server detection turned off, and it looks like windoze didn't report the mime.type when it created the file. I'm not sure if this is a known issue, so I'll head over to the webdav issue pages next. I've since turned on server side detection, and that seems to be working, but in the meantime I've got quite a few files that need to have their mime types re-detected.
When downloading the files with Google Chrome, I get files like file.pdf.bin.pdf (it apparently gets what's going on) but Firefox/IE get file.pdf.bin -
Thanks,
Justin

#1
See #282955: Use other file MIME detection instead of the mime.types file, I'm planning of letting overwrite the mime types.
#2
Could you upgrade to the dev version of the module and check if the issue is still there?
#3
Sorry for the late reply - I've been on vacation (finally!)...We actually made the site live right before I left, so I haven't actually set up a working sandbox to test things like this. I'll definitely give it a try asap.
#4
I've had a chance to try this out now. It's definitely a vast improvement, but the original problem of pdf's being uploaded via webdav not being recognized properly is still there. pdf's uploaded via webdav download as *.pdf.bin
#5
A screenshot
#6
Justin, I'm passing this issue to you as it is DAV related.
Do you use file_node_save() when you create a file node for a file uploaded via DAV? If not, do you use file_mime_guess() and file_mime_detect() to set the proper MIME type?
Here is how file_node_save() does it:
49 // If we didn't get a proper MIME type from the client, attempt to guess50 // it from the uploaded file name
51 if (empty($file->filemime) || $file->filemime == 'application/octet-stream')
52 $file->filemime = file_mime_guess($file->filepath);
53
54 // If specified by the administrator, we'll always try and autodetect the
55 // MIME type on the server-side for any uploaded files
56 if (FILE_MIME_AUTODETECTION > 0 && ($mime = file_mime_detect($file)))
57 $file->filemime = $mime;