aboutsummaryrefslogtreecommitdiffstats
path: root/main/spamassassin/bad-regexp-and-logic.patch
blob: 62a537b3d79de44d6e26a6b605958aec4eeac12a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From edb00a8d76a625bf03227ee2f6e915c9a0d90bad Mon Sep 17 00:00:00 2001
From: Mark Martinec <mmartinec@apache.org>
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