[dev] mime recognition - extension based
Eric Rostetter
eric.rostetter@physics.utexas.edu
Wed, 10 Jul 2002 17:45:08 -0500
Quoting Michael M Slusarz <slusarz@bigworm.colorado.edu>:
> Quoting jason kawaja <kawaja@ece.ufl.edu>:
> |
> | is the some consensus about determining mime type based on filename
> | extension?
No. :) There is no reliable way to do this.
If done for attachments, it should only be done when the MIME information
is absent or insufficient (application/octet-stream) to justify it.
> | [snip]
> |
> | am wondering why something similar has not been added in yet.
>
> It has - but only in the HEAD branch. It hasn't been backported to the
> RELENG branch because it hasn't been tested all that much, and I'm not sure
> if it even will just because HEAD uses an entirely redesigned MIME
> framework.
Also, there are good reasons not to do it. I receive a lot of .com files,
which MSIE thinks are executable files and tries to run, since MSIE is so
brain dead that even if you give it the correct mime type it will over ride
that info with its stupid file extension matching. Well, they are
executable but on a OpenVMS system, not a Windows system. Same with .doc
files (text files in OpenVMS, not MS Word files). Could go on (.exe files,
etc) but I think you get the idea. Just because it has a file extension
your machine knows, doesn't mean it is that type of file!
If I'm correct as to what Michael is talking about, then I like his approach.
It leave the attachment there as-is, and then adds an *additional* entry
with his guess. Then I can ignore the guess if it is wrong, or use it if
it is right, without problems...
> michael
--
Eric Rostetter
The Department of Physics
The University of Texas at Austin
"TAD (Technology Attachment Disorder) is an unshakable, impractical devotion
to a brand, platform, product line, or programming language. It's relatively
harmless among the rank and file, but when management is afflicted the damage
can be measured in dollars. It's also contagious -- someone with sufficient
political clout can infect an entire organization."
--"Enterprise Strategies" columnist Tom Yager.