Mimedetect report an error when creating new youtube video. The issue have been tracked down to the embthumb calling mime_detect on the file before it is written on disk.

Error message:
warning: finfo_file() [function.finfo-file]: Failed identify data -1:cannot open `/opt/drupal-6.13/sites/xxxxx.yyyy.com/files/emvideo-youtube-WrrvkPo7TZ4.jpg' (No such file or directory) in /opt/drupal-6.13/sites/xxxxx.yyyy.com/modules/mimedetect/mimedetect.module on line 62.

I simply moved the mime type detection after the file write.

Thanks

Comments

enkara’s picture

Thank you. Why isn't this solved in the stable release?

aaron’s picture

Status: Active » Needs review

because the status hid this patch, so no one was alerted to review it. reviews are welcome, of course.

aaron’s picture

Status: Needs review » Fixed

I had to modify it so we maintain the security checks for .php, etc. thanks @werfu!

Status: Fixed » Closed (fixed)

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

markus_petrux’s picture

Version: 6.x-1.5 » 6.x-2.x-dev
Status: Closed (fixed) » Active
StatusFileSize
new1.52 KB

Sorry to re-open, but we're using 6.x-2.x-dev, and PHP 5.3, and this issue still exits.

The problem is mimedetect cannot be invoked until the file has been stores locally. Otherwise, it will fail because it uses realpath(), and that will return FALSE (in PHP 5.3) if the file does not exist.

Attached patch moves the mime detection _after_ the file has been saved, but it is only done if security check above has not assigned a mime type already.

Patch is against 6.x-2.x, but it may probably be applied to the other branches as well, I think.

Thanks!

markus_petrux’s picture

Status: Active » Needs review

Oops! I made a mistake setting the issue status.