Revision 622052
Go back to digest for 14th January 2007Bug Fixes in KDE-PIM
Make RFC 2231-encoded attachment names work. Patch approved by Ingo (the issues he had were corrected).
RFC 2231 defines an enhanced encoding for attachment filenames, and thunderbird apparently implemented this encoding. RFC 2231 allows one field to be split across multiple numbered entries of the form fieldname*0=....;
fieldname*1=...; fieldname*2=...; or fieldname*0=....; fieldname*1=...; fieldname*2=...;
All these entries first need to be concatenated to form the full value of the field.
Here's a real-life example:
--------------060807060608070200030605
Content-Type: application/vnd.ms-excel;
name*0*=ISO-8859-15''%41%46%42%D6%20%42%65%73
%65%74%7A%75%6E%67%73%6C%69;
name*1*=%73%74%65%20%53%74%61%6E%64%20%32%30%
30%36%2D%31%32%2D%31%39%2E;
name*2*=%78%6C%73
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename*0*=ISO-8859-15''%41%46%42%D6%20%42%65%73
%65%74%7A%75%6E%67%73%6C;
filename*1*=%69%73%74%65%20%53%74%61%6E%64%20%32%
30%30%36%2D%31%32%2D%31;
filename*2*=%39%2E%78%6C%73
As a result, KMail shows %39%2E%78%6C%73 as the file name in both the message preview panel as well as in the mime tree.
With this patch, KMail correctly shows the proper filename.
The patch adds one static method to collect all parts of rfc 2231-encoded params into one single string. That method is then used in two different places for the name and the filename props.
One minor problem remains, though: As the mime library does not have support for rfc2231 encoded attachments, the message is not shown with the attachment icon in the message list.
File Changes
- /branches/KDE/3.5/kdepim/kmail
- /kmmessage.cpp
- /kmmsgbase.cpp
- /kmmsgbase.h
- /kmmsgpart.cpp