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 2004/09/05 05:22:55 UTC

svn commit: rev 43362 - spamassassin/trunk/lib/Mail/SpamAssassin

Author: felicity
Date: Sat Sep  4 20:22:55 2004
New Revision: 43362

Modified:
   spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm
Log:
bug 3749: MIME parts can have no actual body (following the RFC).  previously the parser would ignore that part, but not all mails are RFC compliant...  so now we fake an empty body if the body doesn't actually exist, and add a node in the tree for that part.

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm	(original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm	Sat Sep  4 20:22:55 2004
@@ -469,13 +469,18 @@
       if ($part_array) {
         chomp( $part_array->[-1] );  # trim the CRLF that's part of the boundary
         splice @{$part_array}, -1 if ( $part_array->[-1] eq '' ); # blank line for the boundary only ...
-
-        my($p_boundary);
-	($part_msg->{'type'}, $p_boundary) = Mail::SpamAssassin::Util::parse_content_type($part_msg->header('content-type'));
-        $p_boundary ||= $boundary;
-	dbg("found part of type ".$part_msg->{'type'}.", boundary: ".(defined $p_boundary ? $p_boundary : ''));
-        $self->parse_body( $msg, $part_msg, $p_boundary, $part_array, 0 );
       }
+      else {
+        # Invalid parts can have no body, so fake in a blank body
+	# in that case.
+        $part_array = [];
+      }
+
+      my($p_boundary);
+      ($part_msg->{'type'}, $p_boundary) = Mail::SpamAssassin::Util::parse_content_type($part_msg->header('content-type'));
+      $p_boundary ||= $boundary;
+      dbg("found part of type ".$part_msg->{'type'}.", boundary: ".(defined $p_boundary ? $p_boundary : ''));
+      $self->parse_body( $msg, $part_msg, $p_boundary, $part_array, 0 );
 
       if (defined $boundary && $line =~ /^\-\-\Q${boundary}\E\-\-$/) {
 	# Make a note that we've seen the end boundary