about summary refs log tree commit homepage
path: root/lib/PublicInbox/Address.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2024-01-09 12:49:13 +0000
committerEric Wong <e@80x24.org>2024-01-10 10:27:01 +0000
commit61c44bbd8e57c719a1a4de75a1a11c412173e820 (patch)
tree5939c701ebed5560d54158ba347f89999f5879dd /lib/PublicInbox/Address.pm
parent48cbe0c3c8dc4d2671af19b87185ba68e9fdd689 (diff)
downloadpublic-inbox-61c44bbd8e57c719a1a4de75a1a11c412173e820.tar.gz
For totally bogus things in address fields, we'll fall back to
showing the original entry in the name column when using
Email::Address::XS.

The pure Perl version differs here, but we'll just let them be
different when it comes to handling bogus data.
Diffstat (limited to 'lib/PublicInbox/Address.pm')
-rw-r--r--lib/PublicInbox/Address.pm7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/PublicInbox/Address.pm b/lib/PublicInbox/Address.pm
index a5902cfd..3a59945c 100644
--- a/lib/PublicInbox/Address.pm
+++ b/lib/PublicInbox/Address.pm
@@ -19,8 +19,11 @@ sub xs_names {
 }
 
 sub xs_pairs { # for JMAP, RFC 8621 section 4.1.2.3
-        [ map { # LHS (name) may be undef
-                [ $_->phrase // $_->comment, $_->address ]
+        [ map { # LHS (name) may be undef if there's an address
+                my @p = ($_->phrase // $_->comment, $_->address);
+                # show original if totally bogus:
+                $p[0] = $_->original unless defined $p[1];
+                \@p;
         } parse_email_addresses($_[0]) ];
 }