You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2007/01/23 14:08:30 UTC

svn commit: r499012 - /spamassassin/trunk/lib/Mail/SpamAssassin.pm

Author: jm
Date: Tue Jan 23 05:08:29 2007
New Revision: 499012

URL: http://svn.apache.org/viewvc?view=rev&rev=499012
Log:
remove_spamassassin_markup() / spamassassin -d was broken with CR-LF line endings; it replaced them with LF.  fix, and add test case to strip2.t to prevent future regression.  Also, add a test case for markup (and removal) on a message with no body

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin.pm?view=diff&rev=499012&r1=499011&r2=499012
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin.pm Tue Jan 23 05:08:29 2007
@@ -921,6 +921,10 @@
 
 Note that the B<$mail> object is not modified.
 
+Warning: if the input message in B<$mail> contains a mixture of CR-LF
+(Windows-style) and LF (UNIX-style) line endings, it will be "canonicalized"
+to use one or the other consistently throughout.
+
 =cut
 
 sub remove_spamassassin_markup {
@@ -1053,6 +1057,11 @@
   $hdrs = "\n".$hdrs;   # simplifies regexp below
   1 while $hdrs =~ s/\nX-Spam-.*\n/\n/g;
   $hdrs =~ s/^\n//;
+
+  # re-add DOS line endings
+  if ($mail_obj->{line_ending} ne "\n") {
+    $hdrs =~ s/\r?\n/$mail_obj->{line_ending}/gs;
+  }
 
   # Put the whole thing back together ...
   return join ('', $mbox, $hdrs, $body);