Attachment filename is not properly decoded
I have received a MIME mail with the following attachment headers:
Content-Type: application/pdf;
name="=?UTF-8?B?QlJOMzAwNTVDQjAyOTI4XzAwMDQ3Ni5wZGY=?="
Content-Description: odd-pages.pdf
Content-Disposition: attachment; filename="=?UTF-8?B?QlJOMzAwNTVDQjAyOTI4XzAwMDQ3Ni5wZGY=?="
It is displayed in the attachment list as "odd-pages.pdf", but trying to save it results in a suggesting ./=?UTF-8?B?QlJOMzAwNTVDQjAyOTI4XzAwMDQ3Ni5wZGY=?=
.
This =?UTF-8?B?...?=
encoding for Content-Disposition filename is the 'encoded-word' format defined in RFC 2047. Unfortunately that says:
An 'encoded-word' MUST NOT be used in parameter of a MIME Content-Type or Content-Disposition field, or in any structured field body except within a 'comment' or 'phrase'.
Maybe that filename
field should be ignored if Content-Type
with name
is present? See also https://blog.nodemailer.com/2017/01/27/the-mess-that-is-attachment-filenames/
Reproduced with 1.11.4 and mutt-1-11-4-rel-208-g831ea9c5