Is it possible to rebuild file types (mime.types)?

Justin Hopkins - March 18, 2009 - 16:27
Project:File Server
Version:6.x-1.0-alpha3
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

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

miglius - March 24, 2009 - 19:13

See #282955: Use other file MIME detection instead of the mime.types file, I'm planning of letting overwrite the mime types.

#2

miglius - March 27, 2009 - 00:30
Status:active» postponed (maintainer needs more info)

Could you upgrade to the dev version of the module and check if the issue is still there?

#3

Justin Hopkins - April 13, 2009 - 13:50

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

Justin Hopkins - May 2, 2009 - 20:13

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

Justin Hopkins - May 2, 2009 - 20:14

A screenshot

AttachmentSize
FileFramework.png 31.41 KB

#6

miglius - May 3, 2009 - 20:07
Project:File Framework» File Server
Version:6.x-1.0-alpha4» 6.x-1.0-alpha3
Status:postponed (maintainer needs more info)» active

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 guess
  50     // 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;

 
 

Drupal is a registered trademark of Dries Buytaert.