]> Sergey Matveev's repositories - public-inbox.git/commitdiff
contentid: ignore duplicate References: headers
authorEric Wong <e@yhbt.net>
Thu, 23 Jan 2020 23:05:59 +0000 (23:05 +0000)
committerEric Wong <e@yhbt.net>
Fri, 24 Jan 2020 23:04:58 +0000 (23:04 +0000)
OverIdx::parse_references already skips duplicate
References (which we use in SearchThread for rendering).
So there's no reason for our content deduplication logic
to care if a Message-Id in the Reference header is mentioned
twice.

lib/PublicInbox/ContentId.pm
lib/PublicInbox/OverIdx.pm

index 0c4a8678beb02fa4db436ca12c55eda6bc0edc79..65691593abfcc36cb3cafef29420d627b84d07d6 100644 (file)
@@ -64,8 +64,7 @@ sub content_digest ($) {
        # if we got here, we've already got Message-ID reuse
        my %seen = map { $_ => 1 } @{mids($hdr)};
        foreach my $mid (@{references($hdr)}) {
-               next if $seen{$mid};
-               $dig->add("ref\0$mid\0");
+               $dig->add("ref\0$mid\0") unless $seen{$mid}++;
        }
 
        # Only use Sender: if From is not present
index 189bd21d93bc6731192dd26a333cc79f04b89c3e..5f1007aa68767979cdc8dd0c9a2d8cd34dc886ae 100644 (file)
@@ -230,8 +230,7 @@ sub parse_references ($$$) {
                        warn "References: <$ref> too long, ignoring\n";
                        next;
                }
-               next if $seen{$ref}++;
-               push @keep, $ref;
+               push(@keep, $ref) unless $seen{$ref}++;
        }
        $smsg->{references} = '<'.join('> <', @keep).'>' if @keep;
        \@keep;