Open Bug 611978 Opened 16 years ago Updated 4 months ago

Decoding problem with attachment filenames in TB 3.1.x (long filenames with special chars is incorrectly specified as two filename parameters in a Content-Disposition: header, one in RFC2321 style, another in RFC2047 style)

Categories

(MailNews Core :: MIME, defect)

x86
Windows XP
defect

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: antti.jylkka, Unassigned, NeedInfo)

References

(Blocks 1 open bug)

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fi; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 ( .NET CLR 3.5.30729) Build Identifier: Thunderbird/3.1.6 I have a problem with received mail when it contains an attachment with long filename and there's special characters in it. (For example 'Testiä testiä testiä.pdf') In my case the problem exists only with PMDF V6.3-1 mail server. The others two, my own exim4 server and gmail, work fine. I can reproduce the error by sending mail to myself. If I downgrade to TB 2.0.0.24 the problem is gone. I don't know if this is a bug or something with the server. However Outlook works fine with it. I sent a message to myself with attachment and look the source code from the Sent folder. The filename part looks like this: Content-Type: application/pdf; name="=?ISO-8859-15?Q?Testi=E4_testi=E4_testi=E4=2Epdf?=" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename*0*=ISO-8859-15''%54%65%73%74%69%E4%20%74%65%73%74%69%E4%20%74%65; filename*1*=%73%74%69%E4%2E%70%64%66 Then I look the same message in the INBOX. The filename part looks like this: Content-type: application/pdf; name="=?ISO-8859-15?Q?Testi=E4_testi=E4_testi=E4=2Epdf?=" Content-transfer-encoding: base64 Content-disposition: attachment; filename*0*=ISO-8859-15''%54%65%73%74%69%E4%20%74%65%73%74%69%E4%20%74%65; filename*1*=%73%74%69%E4%2E%70%64%66; filename="=?ISO-8859-15?Q?Testi=E4_testi=E4_testi=E4=2Epdf?=" Thunderbird shows the attachment filename in coded format: =?ISO-8859-15?Q?Testi=E4_testi=E4_testi=E4=2Epdf?= However I can open the attachement, it opens correct application but the filename "corruption" is really annoying. I found the similar bug report from the earlier version 1.5 and there was something about changing the mail.strictly_mime.parm_folding setting but this doesn't work with TB 3. If further testing is needed I'll be glad to do it. Reproducible: Always Steps to Reproduce: 1. Get a PMDF V6.3-1 mail server 2. Send mail to yourself with attachment which has long filename with special chareacters 3. Receive mail and check the attachment filename Actual Results: Thunderbird shows the attachment filname in coded format Expected Results: It should show the filename in decoded format (human readable format).
Tb already stopped wrong application of RFC2047 on filename parameter of Content-Disposition: header. > filename*0*=ISO-8859-15''%54%65%73%74%69%E4%20%74%65%73%74%69%E4%20%74%65; > filename*1*=%73%74%69%E4%2E%70%64%66; is equivalent to next(defined by RFC2231): > filename=ISO-8859-15''%54%65%73%74%69%E4%20%74%65%73%74%69%E4%20%74%65%73%74%69%E4%2E%70%64%66; So, two filename parameters are written in the Content-Disposition: header. > filename=ISO-8859-15''%54%65%73%74%69%E4%20%74%65%73%74%69%E4%20%74%65%73%74%69%E4%2E%70%64%66; > filename="=?ISO-8859-15?Q?Testi=E4_testi=E4_testi=E4=2Epdf?=" Because RFC never defines about wrongly placed multiple same parameters, any mailer can do any action on incorrect header - ignore header, ignore parameter, use one of them, ... Tb probably uses last one - interpret first one then interpret second one, thus second one is used. Second filename parameter means file name is us-ascii string of =?ISO-8859-15?Q?Testi=E4_testi=E4_testi=E4=2Epdf?=, because RFC2047 encoding must not be applied to the filename parameter and RFC2231 has to be used for filename parameter. In contrast to it, wrong application of RFC2047 on name parameter of Content-Type: is still kept for historical reasons, for compatibility with mailer who doesn't fully/correctly support Content-disposition: header. If no filename parameter is put in Content-Disposition: header, Tb decodes name parameter using RFC2047, then file name you are expecting is shown by Tb. Outlook probably happened to use first one, and sender side mailer perhaps adds RFC2047 version of filename parameter in case of mail recipient can not detect filename parameter encoded by RFC2321. It's bug of mailer which mail sender uses.
Summary: Decoding problem with attachment filenames in TB 3.1.x (long filenames with special chars) → Decoding problem with attachment filenames in TB 3.1.x (long filenames with special chars is incorrectly specified as two filename parameters in a Content-Disposition: header, one in RFC2321 style, another in RFC2047 style)
I got same problem. Even if the sender Thunderbird specifies correct Content-Disposition header based on RFC2231, a relaying server which doesn't support RFC2231 seems to add the second filename parameter (encoded as the RFC2047 style) from the Content-Type header. On Thunderbird 2, I could resolve this problem by specifying mail.strictly_mime.parm_folding to 0, because Thunderbird 2 sent both Content-Type and Content-Disposition headers with the RFC2047 style encoding. However, even if I set the pref to 0, Thunderbrid 3.1 always encodes the filename in the Content-Disposition header in the RFC2231 way. As the result, I seem to have no way to solve this problem now.
(In reply to comment #2) > I seem to have no way to solve this problem now. (A) Workaround by user, with Tb as sender side. Use not-so-long ascii file name. As filename*N=... is generated if long file name even when ascii file name, not-so-long ascii file name is required to force filename="..." parameter. (B) Possible solution by Tb as sender side. mail.strictly_mime.parm_folding value for "no filename", primitive mode. 3 = reserved 4 = name : same as 0 (in RFC2047), filename : no filename (if 0, filename in RFC2231) 5 = name : same as 1 (in RFC2047), filename : no filename (if 1, filename in RFC2231) Note: 2 = no name, filename in RFC2231 only (C) Possible solution by Tb as receiver side. (C-1) Use first filename which is converted from filename*(N(*))=. As such relay server merely adds filename=, filename* in RFC2231 remains. (C-2) Ignore filename= if filename*=, fileame*N=, filename*N*= is detected in Content-Disposition: header.
(D) Workaround by user, with Tb as sender side, if addition by relay server. mail.strictly_mime.parm_folding=2 as no name parameter in Content-Type: header, I think filename= is not added.
Blocks: RFC2047
Component: General → Untriaged
Flags: needinfo?(satnamgill700)
Severity: minor → S4
Component: Untriaged → MIME
Product: Thunderbird → MailNews Core
You need to log in before you can comment on or make changes to this bug.