Thomas Bruederli, 09.01.22 17:13:
>> (...)
>>
> That server-side mime-type detection seems to cause more problems than
> solving them. I tend to switch back and just trust the mime-type
> submitted by the client (when uploading). It always worked well for me
> but I'm not using Windows...
>
> ~Thomas
I'm digging more deep and deep in this attachment problem.
fileinfo
- it is for detecting mime type by so called magic numbers
- on the same server, when calling file -bi and finfo_open on the same
doc file it gives you different results
file Munka1.xls
Munka1.xls: Microsoft Office Document
/usr/php5fcgi/bin/php-cgi fileinfo.php
Content-type: text/html
application/octet-stream
So file gives you right, but finfo_open does not.
Actually for docx files it will always detect ZIP as format, because
it's actually a zip, and this will never change!
IMHO we can keep using fileinfo, but we need to combine it with
- extension based method
- using the client submitted mime-type
I like arekm's solution
(http://trac.roundcube.net/attachment/ticket/1485311/mime-detect.patch)
what if we put the list to a external config file, so this can be an option.
If admin wants, he can override the detection of some extensions.
What do you think?
Balazs
_______________________________________________
List info: http://lists.roundcube.net/dev/