]> Sergey Matveev's repositories - public-inbox.git/commitdiff
view: tighten up regexps used for trimming index
authorEric Wong <e@80x24.org>
Thu, 28 Aug 2014 05:06:41 +0000 (05:06 +0000)
committerEric Wong <e@80x24.org>
Thu, 28 Aug 2014 05:08:07 +0000 (05:08 +0000)
The previous regexp matches were too aggressive w.r.t.  scissors.
We destroy trailing whitespace anyways, so do not worry about it
when cutting signatures and patches off.

lib/PublicInbox/View.pm

index 23cb369bedb3e18414f4c050990caa70275bfb36..d1bb93566a5f9fddbf74b270e480665a829e33c9 100644 (file)
@@ -95,11 +95,11 @@ sub index_entry {
                $s =~ s/(?:^[^\n]*:\s*\n)?(?:^&gt;[^\n]*\n)+(?:^\s*\n)?//mg;
 
                # Drop signatures
-               $s =~ s/\n*-- \n.*\z//s;
+               $s =~ s/^-- \n.*\z//ms;
 
                # drop the remainder of git patches, they're usually better
                # to review when the full message is viewed
-               if ($s =~ s/\n*---\n.*\z//s) {
+               if ($s =~ s/^---\n.*\z//ms) {
                        $more = "$pfx...\n";
                }