From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id A52401F8DF for ; Tue, 7 Jul 2020 20:37:39 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 5/5] wwwatomstream: avoid uninitialized warnings for $email Date: Tue, 7 Jul 2020 20:37:38 +0000 Message-Id: <20200707203738.32677-6-e@yhbt.net> In-Reply-To: <20200707203738.32677-1-e@yhbt.net> References: <20200707203738.32677-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: As in Import, we'll fall back to Sender: if From: is missing, and use the primary_address of the inboxes to indicate the total absence of those fields. --- lib/PublicInbox/WwwAtomStream.pm | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/PublicInbox/WwwAtomStream.pm b/lib/PublicInbox/WwwAtomStream.pm index 3b5b133a5..2f9b953b2 100644 --- a/lib/PublicInbox/WwwAtomStream.pm +++ b/lib/PublicInbox/WwwAtomStream.pm @@ -136,16 +136,13 @@ sub feed_entry { $title = '(no subject)' unless defined $title && $title ne ''; $title = title_tag($title); - my $from = $hdr->header('From') or return; + my $from = $hdr->header('From') // $hdr->header('Sender') // + $ctx->{-inbox}->{-primary_address}; my ($email) = PublicInbox::Address::emails($from); - my $name = join(', ',PublicInbox::Address::names($from)); - $name = ascii_html($name); - $email = ascii_html($email); + my $name = ascii_html(join(', ', PublicInbox::Address::names($from))); + $email = ascii_html($email // $ctx->{-inbox}->{-primary_address}); - my $s = ''; - if (delete $ctx->{emit_header}) { - $s .= atom_header($ctx, $title); - } + my $s = delete($ctx->{emit_header}) ? atom_header($ctx, $title) : ''; $s .= "$name$email" . "$title$updated" . qq().