https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7249

            Bug ID: 7249
           Summary: Decode MIME-encoded filenames in attachments
           Product: Spamassassin
           Version: SVN Trunk (Latest Devel Version)
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Libraries
          Assignee: [email protected]
          Reporter: [email protected]

File attachments with non-ascii filenames appear encoded in attachment header.
Example:

Content-Type: application/octet-stream; name=
    "=?utf-8?B?0LTQvtC60YPQvNC10L3RgtGLINC00LvRjyDQvtGC0LTQ?=
    =?utf-8?B?tdC70LAg0LrQsNC00YDQvtCyLnBkZg==?="
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=
    "=?utf-8?B?0LTQvtC60YPQvNC10L3RgtGLINC00LvRjyDQvtGC0LTQ?=
    =?utf-8?B?tdC70LAg0LrQsNC00YDQvtCyLnBkZg==?="

The "real" filename in this example is 'документы для отдела кадров.pdf'.

But spamassassin does not decode such filenames. This bug/feature_missing leads
to Bayes missing actual spam words used in filename and PDFInfo plugin
completely ignoring such attachments because it does not find .pdf extension in
MIME-encoded version of filename.

Suggested patch for decoding mime-encoded filenames in attachments:

--- lib/Mail/SpamAssassin/Message.pm.orig       2015-04-28 22:56:49.000000000
+0300
+++ lib/Mail/SpamAssassin/Message.pm    2015-10-05 13:56:42.000000000 +0300
@@ -1046,6 +1046,7 @@
   elsif ($ct[3]) {
     $msg->{'name'} = $ct[3];
   }
+  if ($msg->{'name'}) { $msg->{'name'} = Encode::decode("MIME-Header",
$msg->{'name'}); }

   $msg->{'boundary'} = $boundary;

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to