about summary refs log tree commit homepage
path: root/lib/PublicInbox/ContentId.pm
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-19 08:14:33 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-19 08:16:34 +0000
commitdd83a896a7eb718dcd49560d0aab967f1f481883 (patch)
tree5c1fdfa3861320d59841e0c23772831f85995335 /lib/PublicInbox/ContentId.pm
parent471cc731579002419d23f64509497dd486dd632c (diff)
downloadpublic-inbox-dd83a896a7eb718dcd49560d0aab967f1f481883.tar.gz
We will be using Sender: in more places if the From: header
is not available, this is one of them.

Followup-to: ("import: fall back to Sender for extracting name and email")
Diffstat (limited to 'lib/PublicInbox/ContentId.pm')
-rw-r--r--lib/PublicInbox/ContentId.pm16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/PublicInbox/ContentId.pm b/lib/PublicInbox/ContentId.pm
index 8347de2d..9082b769 100644
--- a/lib/PublicInbox/ContentId.pm
+++ b/lib/PublicInbox/ContentId.pm
@@ -11,9 +11,6 @@ use PublicInbox::MID qw(mids references);
 # 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 @@ sub content_digest ($) {
                 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;
         }