You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by fe...@apache.org on 2005/05/20 06:47:46 UTC

svn commit: r171048 - /spamassassin/branches/3.0/lib/Mail/SpamAssassin/Message.pm

Author: felicity
Date: Thu May 19 21:47:46 2005
New Revision: 171048

URL: http://svn.apache.org/viewcvs?rev=171048&view=rev
Log:
bug 4328: parsing out the filename from message parts wasn't working properly

Modified:
    spamassassin/branches/3.0/lib/Mail/SpamAssassin/Message.pm

Modified: spamassassin/branches/3.0/lib/Mail/SpamAssassin/Message.pm
URL: http://svn.apache.org/viewcvs/spamassassin/branches/3.0/lib/Mail/SpamAssassin/Message.pm?rev=171048&r1=171047&r2=171048&view=diff
==============================================================================
--- spamassassin/branches/3.0/lib/Mail/SpamAssassin/Message.pm (original)
+++ spamassassin/branches/3.0/lib/Mail/SpamAssassin/Message.pm Thu May 19 21:47:46 2005
@@ -586,8 +586,9 @@
 
   dbg("parsing normal part");
 
-  $part_msg->{'type'} =
-    Mail::SpamAssassin::Util::parse_content_type($part_msg->header('content-type'));
+  # 0: content-type, 1: boundary, 2: charset, 3: filename
+  my @ct = Mail::SpamAssassin::Util::parse_content_type($part_msg->header('content-type'));
+  $part_msg->{'type'} = $ct[0];
 
   # multipart sections are required to have a boundary set ...  If this
   # one doesn't, assume it's malformed and revert to text/plain
@@ -595,7 +596,7 @@
 
   # attempt to figure out a name for this attachment if there is one ...
   my $disp = $part_msg->header('content-disposition') || '';
-  my($filename) = $disp =~ /name="?([^\";]+)"?/i || $part_msg->{'type'} =~ /name="?([^\";]+)"?/i;
+  my($filename) = $disp =~ /name="?([^\";]+)"?/i || $ct[3];
 
   $part_msg->{'raw'} = $body;
   $part_msg->{'boundary'} = $boundary;