Re: bug in attachment handling

Subject: Re: bug in attachment handling

Date: Tue, 30 Jul 2013 16:16:36 +0100



From: Mark Walters

On Tue, 30 Jul 2013, Mark Walters <> wrote:
> Hi
> I have been seeing a bug in attachment handling in recent notmuch. If a
> pdf part is sent as application/octet-stream then notmuch says
> [[file.pdf: application/octet-stream (as application/pdf) ] but when
> viewing it with . v or the default button action (when customised to
> view) it treats it as application/octet-stream.
> I think this is a regression but haven't checked yet: it probably has a
> simple fix so we may want to fix it before 0.16 (users may be grumpy
> about the key binding changes etc as it is!)
> I attach a pdf with this message (just a mozilla print-to-file of the
> notmuch webpage) which should demonstrate the problem.

I have now checked that it is a regression: 0.15 is fine and git bisect
gives the first bad commit as 1546387d723ec47cd281f3c2bf6da2fddf18c045.

The problem comes because we used to store the content-type with the
button: it was called content-type but in the function
notmuch-show-insert-part-header this was the "calculated content-type"
(with declared-type being the originally declared type).

Elsewhere though content-type is used for the original declared-type
including where the version post 1546 above picks it up (in

So somehow we need to get the calculated content-type into that
function. I am not sure what the cleanest way  to do that is so will
just post this for now.

Best wishes