Don't trust the browser and use file_get_mimetype()'s more complete database.

zoro - December 4, 2008 - 11:22
Project:MimeDetect
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Line 194:

  // Trust the browser...  ack!
  if (!$mime) {
    $mime = $file->filemime;
  }

Is there a specific reason why you're trusting the browser for file-type checking before the list of extensions?
I'm having an issue here, where m4a files (aac) aren't being correctly recognised as "audio/mp4", so I've added them to the list of known extension_mimes, and moved the browser-trust BELOW the mime checker.

#1

drewish - April 15, 2009 - 18:54
Title:Trust the browser?» Don't trust the browser and use file_get_mimetype()'s more complete database.
Version:5.x-1.0» 6.x-1.x-dev
Status:active» needs review

you're right it really isn't a good idea. i'm dropping it and using core's file_get_mimetype() function since it's got a more complete database of extension to mime mappings.

AttachmentSize
mimedetect_342636.patch 5.44 KB

#2

drewish - April 15, 2009 - 19:18
Status:needs review» fixed

found that mimedetect_mime() wasn't actually checking if the mimedetect_enable_file_binary variable was true before calling file. fixed that so i'm going to go ahead and commit this to HEAD and DRUPAL-5.

#3

drewish - April 15, 2009 - 19:18

forgot the patch.

AttachmentSize
mimedetect_342636.patch 6.45 KB

#4

drewish - April 15, 2009 - 19:26

here's what went into D5

AttachmentSize
mimedetect_342636.D5.patch 6.46 KB

#5

System Message - April 29, 2009 - 19:30
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.