]> Sergey Matveev's repositories - public-inbox.git/commitdiff
mid: extract Message-ID from inside '<>'
authorEric Wong <e@80x24.org>
Thu, 27 Aug 2015 04:34:00 +0000 (04:34 +0000)
committerEric Wong <e@80x24.org>
Thu, 27 Aug 2015 06:04:51 +0000 (06:04 +0000)
This is necessary for some mailers which include comment text
in in the In-Reply-To header, merely assuming there is nothing
outside of '<>' as we were doing is not enough.

lib/PublicInbox/MID.pm

index 02ac7095dd1f39503f75568554b93e510dbad091..8ca3c5797e314e6440aaf36ebc1c1fc4b7134e7c 100644 (file)
@@ -12,8 +12,9 @@ sub mid_clean {
        my ($mid) = @_;
        defined($mid) or die "no Message-ID";
        # MDA->precheck did more checking for us
-       $mid =~ s/\A\s*<?//;
-       $mid =~ s/>?\s*\z//;
+       if ($mid =~ /<([^>]+)>/) {
+               $mid = $1;
+       }
        $mid;
 }