From ce5af2029b6bc703f3d8cf7bb5c68732c41f210e Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Thu, 19 Jul 2018 14:36:31 -0500 Subject: Import.pm: Deal with potentially missing From and Sender headers 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 --- lib/PublicInbox/Import.pm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/PublicInbox/Import.pm') 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); } -- cgit v1.2.3-24-ge0c7