From: Eric Wong Date: Thu, 23 Jan 2020 23:05:59 +0000 (+0000) Subject: contentid: ignore duplicate References: headers X-Git-Tag: v1.3.0~83 X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=2a56039ff6a6a8d0b04437b5463c172ecab002c5 contentid: ignore duplicate References: headers 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. --- diff --git a/lib/PublicInbox/ContentId.pm b/lib/PublicInbox/ContentId.pm index 0c4a8678..65691593 100644 --- a/lib/PublicInbox/ContentId.pm +++ b/lib/PublicInbox/ContentId.pm @@ -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 diff --git a/lib/PublicInbox/OverIdx.pm b/lib/PublicInbox/OverIdx.pm index 189bd21d..5f1007aa 100644 --- a/lib/PublicInbox/OverIdx.pm +++ b/lib/PublicInbox/OverIdx.pm @@ -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;