From edb00a8d76a625bf03227ee2f6e915c9a0d90bad Mon Sep 17 00:00:00 2001 From: Mark Martinec Date: Tue, 11 Apr 2017 18:37:20 +0000 Subject: [PATCH] Bug 7404: Bad regexp (and logic) in MS::PerMsgStatus::get_content_preview git-svn-id: https://svn.apache.org/repos/asf/spamassassin/trunk@1791010 13f79535-47bb-0310-9956-ffa450edef68 --- lib/Mail/SpamAssassin/PerMsgStatus.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Mail/SpamAssassin/PerMsgStatus.pm b/lib/Mail/SpamAssassin/PerMsgStatus.pm index f8c55061b..126157bf5 100644 --- a/lib/Mail/SpamAssassin/PerMsgStatus.pm +++ b/lib/Mail/SpamAssassin/PerMsgStatus.pm @@ -896,16 +896,16 @@ sub get_content_preview { $str .= shift @{$ary}; } undef $ary; - chomp ($str); $str .= " [...]\n"; # in case the last line was huge, trim it back to around 200 chars local $1; - $str =~ s/^(.{,200}).*$/$1/gs; + $str =~ s/^(.{200}).+$/$1 [...]/gm; + chomp ($str); $str .= "\n"; # now, some tidy-ups that make things look a bit prettier - $str =~ s/-----Original Message-----.*$//gs; + $str =~ s/-----Original Message-----.*$//gm; $str =~ s/This is a multi-part message in MIME format\.//gs; - $str =~ s/[-_\*\.]{10,}//gs; + $str =~ s/[-_*.]{10,}//gs; $str =~ s/\s+/ /gs; # add "Content preview:" ourselves, so that the text aligns