about summary refs log tree commit homepage
path: root/lib/PublicInbox
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2018-07-19 14:36:31 -0500
committerEric Wong <e@80x24.org>2018-07-19 20:40:49 +0000
commitce5af2029b6bc703f3d8cf7bb5c68732c41f210e (patch)
tree926362dfb539b48b7a137a66c488dcecf8878b42 /lib/PublicInbox
parent7faaa2ab3464880aabbba909acd48a4b11b67452 (diff)
downloadpublic-inbox-ce5af2029b6bc703f3d8cf7bb5c68732c41f210e.tar.gz
Use ||= '' to ensure that if the From or Sender header is not present
the code sees an empty string and instead of undefined.

I had some email messages with a From field without an @ (because the
sender was local) and without a Sender which were causing errors when
imported.  I think this was bad enough that the email messages were
failing to be imported.

Signed-off-by: Eric Biederamn <ebiederm@xmission.com>
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r--lib/PublicInbox/Import.pm2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm
index f320c58c..4e3b4c55 100644
--- a/lib/PublicInbox/Import.pm
+++ b/lib/PublicInbox/Import.pm
@@ -278,10 +278,12 @@ sub extract_author_info ($) {
 
         my $sender = '';
         my $from = $mime->header('From');
+        $from ||= '';
         my ($email) = PublicInbox::Address::emails($from);
         my ($name) = PublicInbox::Address::names($from);
         if (!defined($name) || !defined($email)) {
                 $sender = $mime->header('Sender');
+                $sender ||= '';
                 if (!defined($name)) {
                         ($name) = PublicInbox::Address::names($sender);
                 }