On Mon, Jul 23, 2012 at 06:13:45PM -0400, Todd Goodman wrote:
> * Walter Dnes <waltd...@waltdnes.org> [120723 17:48]:
> >   My ISP emails invoices+receipts as PDF files.  Thay made a change in
> > the "mime type" earlier this year that makes things more difficult...
> > 
> > Before
> > ======
> > [-- Attachment #2: blah_blah_blah.pdf --]
> > [-- Type: application/pdf, Encoding: base64, Size: 47K --]
> > 
> > [-- application/pdf is unsupported (use 'v' to view this part) --]
> > 
> > After
> > =====
> > [-- Attachment #2: blah_blah_blah.pdf --]
> > [-- Type: application/octet-stream, Encoding: base64, Size: 79K --]
> > 
> > [-- application/octet-stream is unsupported (use 'v' to view this part) --]
> > 
> >   With "Type: application/pdf" I hit "v" and epdfview brought up the
> > document.  With "Type: application/octet-stream" I have to save the
> > attachment and manually open with epdfview.  Mime-type is useless in
> > this situation.  Is there a way to force the file to be opened based on
> > extension rather than mime type?
> 
> I think you could use something like mutt.octet.filter (There's a perl
> version at http://www.davep.org/mutt/mutt.octet.filter.pl) to handle
> application/octet-stream mime types.
> 
> It uses file to try to determine the proper type and can then use
> whatever is in your mailcap to determine what to run.
> 
> It should be pretty easy to extend it to match on filename if you really
> wanted to.

There is also stuff in portage to handle it, like
dev-perl/File-MimeInfo, with which your mailcap can look like this:

    application/octet-stream; mimeopen %s

It uses the file extension by default, but can use magic, too.


Cheers,

Henry

Reply via email to