[horde] client mime-type mismatch
Andrew Morgan
morgan at orst.edu
Thu Jan 21 21:45:11 UTC 2010
On Thu, 21 Jan 2010, Michael M Slusarz wrote:
> Quoting Andrew Morgan <morgan at orst.edu>:
>
>> On Thu, 21 Jan 2010, Michael M Slusarz wrote:
>>
>>> Quoting Michael Rubinsky <mrubinsk at horde.org>:
>>>
>>>> Quoting Andrew Morgan <morgan at orst.edu>:
>>>>
>>>>> I was able to replicate this problem on my own computer and started
>>>>> searching in Horde for some problem with mime-type detection. Finally I
>>>>> realized that it was my own browser sending the wrong mime-type! When I
>>>>> looked in Firefox's content-type handling, I saw:
>>>>>
>>>>> PDF File (application/applefile) Always Ask
>>>>> PDF File (application/pdf) Open with xpdf
>>>>>
>>>>> Once I edited the mimeTypes.rdf file to remove all applefile references,
>>>>> the problem was fixed (for me).
>>>>>
>>>>> Obviously, Horde is using the mime-type reported by the client browser.
>>>>> Is that still a good idea, or would it be better if Horde used it own
>>>>> mime detection (or fileinfo) on all uploaded files?
>>>>>
>>>>> Finally, does anyone know how I got that crazy mime-type in Firefox?
>>>>
>>>> Yup. This is a known issue with FF and has been discussed a few times on
>>>> our mailing lists. In fact, there was a recent discussion about replacing
>>>> client side with server side detection. See the following for the start
>>>> of the thread:
>>>>
>>>> http://lists.horde.org/archives/dev/Week-of-Mon-20100111/024651.html
>>>
>>> ...or just skip ahead and see the solution (IMP 5 only):
>>>
>>> http://lists.horde.org/archives/commits/2010-January/002854.html
>>
>> Well, I agree that is *a* solution, although if I'm reading it right, the
>> default hook code won't fix my problem. If the browser supplies a
>> mime-type that is not application/octet-stream, it won't do the server-side
>> detection.
>
> By default, no. That's precisely the point since 99% of the time the
> browser-side detection will be correct.
>
>> Obviously, I can modify the hook to force server-side detection, or at
>> least override it for application/applefile, so that seems good to me!
>
> And that's precisely the elegance of this solution. Admins can now fix this
> server-side instead of tracking this down on a particular browser on a
> particular user's machine.
>
> The idea is to potentially add some more checking to the default hook to
> handle troublesome MIME types. Not sure if your situation was a one-time
> only issue or something that may occur on a more frequent basis across
> numerous installations.
Apparently this is a widespread problem with Firefox and Thunderbird:
http://www.google.com/#hl=en&q=firefox+mime+types+applefile
In order to have the least impact, I could trigger server-side mime-type
detection only on application/applefile uploads.
Andy
More information about the horde
mailing list