Greg Troxel | 3 Nov 2008 13:52

Re: Auto-overriding *.pdf application/octet-stream MIME type?

  From: Simon Josefsson <simon <at> josefsson.org>

  What do people think about a variable that can be used to auto-override
  MIME types based on filename extensions?  I get a lot of *.pdf marked as
  application/octet-stream and selecting 'View as Type' feels dull.

I have been annoyed by dealing with messages that come with wrong mime
types and definitely second the notion that support would be nice.

  Something like this:

  (setq mm-content-type-mapping
        '(("application/octet-stream" "*.pdf" "application/pdf")))

  The cells would be of the form (INCOMING-TYPE EXTENSION MAPPED-TYPE),
  and either of INCOMING-TYPE or EXTENSION can be nil to match anything.

That looks good to me.  I would have at first left out the first item,
but on reflection I think that almost all miscoded objects are labeled
application/octet-stream.  This lets one have the narrowest effective
configuration.

Is the extension field going to be a regexp, glob, or string?  Probably
it should be a regex for an extension, with an implied ".*\." before it.

Besides .pdf, .doc, .ppt and .xls labeled as application/octet-stream,
the other problem I have is getting patches labeled as
application/octet-stream.  I tend to call them text/plain, but I think
there is application/x-patch.  Fixing this would seem to require having
a "body test", basically running file on the part, and this seems harder
(Continue reading)

Rupert Swarbrick | 3 Nov 2008 19:13

Re: Auto-overriding *.pdf application/octet-stream MIME type?

Greg Troxel <gdt <at> work.lexort.com> writes:

>   From: Simon Josefsson <simon <at> josefsson.org>
>
>   What do people think about a variable that can be used to auto-override
>   MIME types based on filename extensions?  I get a lot of *.pdf marked as
>   application/octet-stream and selecting 'View as Type' feels dull.
>
> I have been annoyed by dealing with messages that come with wrong mime
> types and definitely second the notion that support would be nice.
>
>   Something like this:
>
>   (setq mm-content-type-mapping
>         '(("application/octet-stream" "*.pdf" "application/pdf")))
>
>   The cells would be of the form (INCOMING-TYPE EXTENSION MAPPED-TYPE),
>   and either of INCOMING-TYPE or EXTENSION can be nil to match anything.
>
> That looks good to me.  I would have at first left out the first item,
> but on reflection I think that almost all miscoded objects are labeled
> application/octet-stream.  This lets one have the narrowest effective
> configuration.

May I suggest that a list of 3 elements is as above, but one can leave
out the first to match all incoming MIME types?

So

  ("application/octet-stream" "*.pdf" "application/pdf")
(Continue reading)


Gmane