[imp] Attachment corruption problem

Daniel A. Ramaley daniel.ramaley at DRAKE.EDU
Wed Apr 26 13:11:51 PDT 2006

On Wednesday 26 April 2006 12:33, Michael M Slusarz wrote:
>2.) MIME magic reports application/octet-stream data as text/*
>This may or may not be a Horde issue.  This is only a Horde issue if
>our internal MIME magic detection is used.  But this is the *third*
>option and is only used if both the PECL fileinfo module is not
>installed and the PHP mime_magic extesion is not available.  If either
>of these modules are used, then the issue is with their mime magic
>algorithims which is something out of the control of us.

Thank you for the lengthy explanation of how mime types and file 
encodings are figured out! That helps much. The web browser uploads the 
problem file as application/octet-stream, so the problem must be with 
MIME detection.

The file that i have been having trouble with is named DU41.PAK. It is a 
data file for a statistics application used by the athletics 
department. It is about 16 kB in size. Of all the data it contains, 
only 1 character is in the upper half of the ASCII set. So except for 
that one character, the file might look like plain text to a MIME 
detection algorithm. I added a few debug statements to analyzeFile in 
horde/lib/Horde/MIME/Magic.php. I found that my installation is using 
the mime_magic extension, and that mime_magic reports the data as 
text/plain. So that's where the real problem is.

Since Imp can also use the fileinfo extension (and since it is listed 
first in the code, i assume that it is preferred), i'm going to try to 
get that working and see if it works correctly on this file.

Now i am inclined to wonder what sort of MIME detection that commercial 
webmail providers (Yahoo, Hotmail, etc.) and desktop e-mail clients use 
and how we could get it for Imp. I don't know how well other MIME 
detection routines work in general, but for the one file that i've 
found to be problematic they certainly do a better job.

Dan Ramaley                            Dial Center 118, Drake University
Network Programmer/Analyst             2407 Carpenter Ave
+1 515 271-4540                        Des Moines IA 50311 USA

More information about the imp mailing list