about summary refs log tree commit homepage
path: root/lib/PublicInbox/Address.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-12-14 05:22:18 +0000
committerEric Wong <e@80x24.org>2019-12-15 19:43:33 +0000
commit3d20f6e4c214747b3e700d30e4cac70a33a817d8 (patch)
treecf0165f83f30c61ee50477a147a226aef0e66967 /lib/PublicInbox/Address.pm
parent69ae87044ca499aa401c73a9a1d764013539fb2d (diff)
downloadpublic-inbox-3d20f6e4c214747b3e700d30e4cac70a33a817d8.tar.gz
Apparently, neither our previous address parsing code nor
Email::Address::XS recognizes local, username-only addresses
in the form of <username> (without "@host").  Without
this change, Email::Address::XS->address would return
"undef", so we need to filter it out via "grep { defined }"

It seems the cases where users email each other on the same
machine is small and public-inbox won't be able to index
addresses for those cases...  Oh well :/
Diffstat (limited to 'lib/PublicInbox/Address.pm')
-rw-r--r--lib/PublicInbox/Address.pm9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/PublicInbox/Address.pm b/lib/PublicInbox/Address.pm
index 433b36eb..c23a5d62 100644
--- a/lib/PublicInbox/Address.pm
+++ b/lib/PublicInbox/Address.pm
@@ -4,12 +4,15 @@ package PublicInbox::Address;
 use strict;
 use warnings;
 
-sub xs_emails { map { $_->address() } parse_email_addresses($_[0]) }
+sub xs_emails {
+        grep { defined } map { $_->address() } parse_email_addresses($_[0])
+}
 
 sub xs_names {
-        map {
+        grep { defined } map {
                 my $n = $_->name;
-                $n = $_->user if $n eq $_->address;
+                my $addr = $_->address;
+                $n = $_->user if defined($addr) && $n eq $addr;
                 $n;
         } parse_email_addresses($_[0]);
 }