[Zope-dev] IE and Zope MIME type handling
Paul Erickson
erickson@kaivo.com
Mon, 22 Oct 2001 13:16:57 -0600
I agree with solution #2. When I upload a .xls file from Mozilla on
Linux, it also says that it is application/octet-stream.
Even more annoying: Netscape 4.7.x says that it is
"application/vnd.ms-excel", while Konqueror says "application/ms-excel"
for the same file. For sites that want to enforce, it makes me think
that it might be better to do #2 even for non octet mime types.
-Paul
Casey Duncan wrote:
>Problem: Getting Zope to properly detect MIME types of posted files
>
>The current solution is to try the following methods:
>
>1. See if the browser specified a type and if so, use it.
>2. See if the file extension can be recognized and derive a mime-type from it
>3. Do some inspection of the file data (limited to text files at present)
>
>Obviously #1 is preferred, and anytime the browser supplies the mime type,
>method #2 and #3 are never used. However, I have found a problem with this.
>Sometimes, IE reports a mime-type of "application/octet-stream" on files that
>is doesn't know better about.
>
>This specifically happens on WordPerfect files. Now, I am as shocked as you
>are that a competitor's file format would not be recognized by IE, however,
>difficult as this may be to believe, it appears to be true.
>
>My proposed solution and change in behavior is to ignore the browser supplied
>type if it is "application/octet-stream" and use #2 and perhaps #3 in that
>case to delve in further. Obviously this may pose a problem for applications
>that rely on the mime-type for files with extensions that might otherwise
>indicate something else. But since this behavior seems restricted to IE
>(amongst the browsers I tested), I doubt it would cause harm or breakage.
>
>Thoughts?
>
>I will supply the necessary patches if there is no objection.
>
>/---------------------------------------------------\
> Casey Duncan, Sr. Web Developer
> National Legal Aid and Defender Association
> c.duncan@nlada.org
>\---------------------------------------------------/
>
>_______________________________________________
>Zope-Dev maillist - Zope-Dev@zope.org
>http://lists.zope.org/mailman/listinfo/zope-dev
>** No cross posts or HTML encoding! **
>(Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope )
>