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
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | emthumb-6.x-2.x-661410-5.patch | 1.52 KB | markus_petrux |
| embthumb.patch | 2.32 KB | werfu |
Comments
Comment #1
enkara commentedThank you. Why isn't this solved in the stable release?
Comment #2
aaron commentedbecause the status hid this patch, so no one was alerted to review it. reviews are welcome, of course.
Comment #3
aaron commentedI had to modify it so we maintain the security checks for .php, etc. thanks @werfu!
Comment #5
markus_petrux commentedSorry 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!
Comment #6
markus_petrux commentedOops! I made a mistake setting the issue status.