lib/PublicInbox/ContentId.pm | 16 ++++++++++++---- diff --git a/lib/PublicInbox/ContentId.pm b/lib/PublicInbox/ContentId.pm index 8347de2d2846654ef2042c4d34aa6d4595e92dc1..9082b7694002168467ab3d2610a36631348116d2 100644 --- a/lib/PublicInbox/ContentId.pm +++ b/lib/PublicInbox/ContentId.pm @@ -11,9 +11,6 @@ # not sure if less-widely supported hash families are worth bothering with use Digest::SHA; -# Content-* headers are often no-ops, so maybe we don't need them -my @ID_HEADERS = qw(Subject From Date To Cc); - sub content_digest ($) { my ($mime) = @_; my $dig = Digest::SHA->new(256); @@ -31,7 +28,18 @@ foreach my $mid (@{references($hdr)}) { next if $seen{$mid}; $dig->add('ref: '.$mid); } - foreach my $h (@ID_HEADERS) { + + # Only use Sender: if From is not present + foreach my $h (qw(From Sender)) { + my @v = $hdr->header_raw($h); + if (@v) { + $dig->add("$h: $_") foreach @v; + last; + } + } + + # Content-* headers are often no-ops, so maybe we don't need them + foreach my $h (qw(Subject Date To Cc)) { my @v = $hdr->header_raw($h); $dig->add("$h: $_") foreach @v; }