I'm chasing a problem with encoded filename attachments (QP and base64)
where reformime isn't decoding them. Like:
------=_NextPart_000_0015_01C50864.97F08000
Content-Type: text/plain; format=flowed;
name="=?iso-8859-1?B?YmzhYmzhLnR4dA==?="; reply-type=original
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="=?iso-8859-1?B?YmzhYmzhLnR4dA==?="
When used with reformime -x, the suggested filename is:
_iso-8859-1_B_YmzhYmzhLnR4dA____
An ancient changelog mentions that this should be fixed:
* V1.2 - Switched installation layout to GNU layout. Packaged development
libraries. reformime -x option now MIME decodes 8-bit filenames
(then promptly strips 8bit characters :-) ).
However, even with current version (1.8.0), get_suitable_filename() would not
do it. It would only strip 8bit characters.
The attached patch seems to fix it for me. Please let me know if I'm wrong, I'm
still going over
the details of what exactly this function does and if strdup there was really a
mistake.
--- maildrop-1.8.0/rfc2045/reformime.c~ 2004-06-26 12:20:14.000000000 -0300
+++ maildrop-1.8.0/rfc2045/reformime.c 2005-02-01 16:50:14.283092882 -0200
@@ -357,11 +357,11 @@
if (!disposition_filename_s || !*disposition_filename_s)
disposition_filename_s=disposition_name;
if (!disposition_filename_s || !*disposition_filename_s)
disposition_filename_s=content_name;
- filename_buf=strdup(disposition_filename_s);
+ filename_buf=rfc2047_decode_simple(disposition_filename_s);
if (!filename_buf)
{
perror("rfc2047_decode_simple");
exit(1);