Re: incorrect mime types



On Tue, 11 September 00:45 Heber Farnsworth wrote:
> Balsa is inconsistent in recognizing mime types.  I frequently get e-mails
> with pdf files attached.  These seem to always be listed as
> application/octet-stream so I have to save the attachment and start a
> viewer.  

The type of a MIME part in a message is determined by the value of the
Content-Type: header.  This is set by the sending UA.  There is no
ambiguity about the type of the part from the receiving UA's point of
view.

If your files, that you know to be PDFs, are marked as application/octet-stream,
the problem lies with the sending UA.

> I thought this might be a problem in how the sender's mail was configured
> but then I opened my mailbox with Netscape mail and it correctly identified
> the attachment as application/pdf.

It is a problem with the sending UA.  Balsa uses the gnome-mime stuff to
figure out a MIME type for a file.  Netscape uses a different data base
(.mailcap?).  Expect the two to be inconsistent.  However Netscape does more,
what I think is happening is this: it examines the Content-disposition: header
if it is present and the content type is application/octet-stream.  If there is
a file name parameter (to Content-disposition:) it probably uses this to
determine a MIME type against its own data base before giving up.  I feel that
this is going too far because it is working around what it perceives to be a
problem in the sending UA.  Second guessing the sender's intentions like this
is never reliable.  Using NS or OE as metrics of correct behaviour is not a
good idea.  If you need to know more about MIME, scan over RFCs 2045-9.

> Then I thought balsa must not be able to recognize this mime type but this
> isn't true either because I can save an attachment I was sent and then
> attach it to a new e-mail and balsa correctly lables the attachment as
> application/pdf.  

Gnome mime works out MIME types from file name extensions. (file contents too?)
This is a common enough technique.

> Balsa is good at most mime types.  I have no problem with Excel files or
> Word documents (I mean balsa has no problem -- I send nasty-grams to people
> who send Word files.)  These are correctly identified and balsa let's me
> spawn a viewer.  What's up with pdf?
> 
> Try this.  I've attached a small pdf file as a test.  In the attachment
> pane of the compose window it is listed as application/pdf.  When I send it
> to myself it shows up was x-unknown/(null).  Why not pdf?

Hmmm... x-unknown/* is a *really* bad idea for a default and should be fixed.
x-unknown/(null) is worse; firstly ( and ) are prohibited from appearing in the
type or subtype tokens and secondly (null) does not start with "x-".  Its the
same old story again - programmers are too lazy to verify their code against
the relevant standards when they apply.  Given the free availability of RFCs,
this is inexcusable.

IIRC, the default MIME type for unknown content types is
application/octet-stream.
The use of anything other than the 5 standard top-level MIME types (text,
image, audio, application and multipart) is strongly discouraged and Gnome
MIME / Balsa should respect this.

Brian Stafford




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]