]> Sergey Matveev's repositories - public-inbox.git/commitdiff
searchmsg: preserve hard tabs, but drop CR (\r)
authorEric Wong <e@80x24.org>
Sat, 12 Mar 2016 06:51:22 +0000 (06:51 +0000)
committerEric Wong <e@80x24.org>
Sat, 12 Mar 2016 06:51:22 +0000 (06:51 +0000)
Hard tabs *may* be searchable, so preserve them since they do
not take up any more space than a normal space.  However, CR
(carriage return) is worthless and likely a sign of a buggy mail
(or spam) client anyways.

lib/PublicInbox/SearchMsg.pm

index 477ffff773610d1faaa869187c860624b440e0a5..a089915952f1b76ef753fcdcb67891f1d5705de6 100644 (file)
@@ -65,7 +65,8 @@ sub __hdr ($$) {
        my $mime = $self->{mime} or return;
        $val = $mime->header($field);
        $val = '' unless defined $val;
-       $val =~ tr/\t\r\n/ /;
+       $val =~ tr/\n/ /;
+       $val =~ tr/\r//d;
        $self->{$field} = $val;
 }