[imp] How to get unrecognized file type to

lst_hoe02 at kwsoft.de lst_hoe02 at kwsoft.de
Thu Jun 25 10:46:13 UTC 2009


Zitat von Lucien GENTIS <lucien.gentis at lorraine.iufm.fr>:

> Lucien GENTIS a écrit :
>> Zitat von Michael M Slusarz <slusarz at horde.org>:
>>
>>> Quoting lst_hoe02 at kwsoft.de:
>>>
>>>> Hello
>>>>
>>>> we have the problem that attachments sent with Horde/IMP arrive  
>>>> as  Content-Type text/plain at receiver side and are therefore   
>>>> useless/corrupted (7-Zip Files for example). If have digged  
>>>> around  a little bit but get lost in the MIME-Type mess. We have  
>>>> tried to  change the "DefaultType" directive in Apache to   
>>>> "application/octet-stream" but the problem still persists.
>>>>
>>>> As far as i understand Horde/IMP uses the Content-Type sent by  
>>>> the  User Browser or try to detect it by mime_magic/fileinfo if  
>>>> not set?
>>>
>>> That is incorrect.  IMP uses the Content-Type provided by the   
>>> browser first.  If that content-type is application/octet-stream,   
>>> only then will mime magic be used to determine the actual MIME type.
>>>
>>>
>>>> How can i check what is sent by the browser (tcpdump search?)
>>>>
>>>> How can i check what would be detected by Horde/IMP "by hand"
>>>>
>>>> Can anyone confirm this behavior or is this some error in my setup
>>>>
>>>> Tests done :
>>>> Send e-Mail with attachment consist of random data (dd   
>>>> if=/dev/urandom of=some.file count=100) with either IE8 or  
>>>> Firefox  3.0.11. Check with mailclient to seen the Content-Type  
>>>> as  text/plain. Checked with md5sum that the resulting files are   
>>>> different.
>>>
>>> Either your browser is sending the wrong content-type or your   
>>> fileinfo db is reporting the wrong info.  Neither is an IMP issue   
>>> however since both are out of our control.
>>
>> It happens with IE8/IE6 and Firefox 3.0.11 on a stock XP SP3 so i   
>> guess the browsers send application/octet-stream as they should.
>> This lead to the fileinfo db which i'm unsure where to find. Both   
>> systems tested with the wrong behavior are Ubuntu (6.06 and 8.04)   
>> stock install. As far as i can tell they use mime_magic build into  
>> PHP  and not PECL. One is PHP 5.1.x and the other 5.2.x. From what  
>> i can  see (http://pecl.php.net/package/Fileinfo) the PECL fileinfo  
>> has moved  to standard PHP source again so mime_magic extension is  
>> replaced with  PECL fileinfo which is replaced by PHP extension  
>> fileinfo??
>> Is there any short PHP code to test what IMP will detect for a  
>> given  file?? if using "file -i" the result is  
>> "application/octet-stream" as  it should.
>>
>> Many Thanks
>>
>> Andreas
>>
> Hello,
>
> I had the same problem ; so, I looked at http://wiki.horde.org/MimeMagic
> and found that |mime_magic.magicfile had to be defined in php.ini.
>
> So I added this definition with the same magic file path as in
> horde/config/conf.php (for me /usr/share/file/magic), and yet, MIME
> types are correctly recognized (at least msword and msexcel)

Many thanks !!!
This finally solved the issue. No idea why the standard Ubuntu  
installation lacks this setting in php.ini. Strange thing is that no  
error ever appears in the logfiles about missing "magic" file.

Andreas



More information about the imp mailing list