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-ASN: 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 44B8E1F4C8 for ; Thu, 24 Oct 2019 00:12:43 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [RFC 7/7] view: show X-Alt-Message-ID in permalink view, too Date: Thu, 24 Oct 2019 00:12:41 +0000 Message-Id: <20191024001241.14224-8-e@80x24.org> In-Reply-To: <20191024001241.14224-1-e@80x24.org> References: <20191024001241.14224-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Since we index X-Alt-Message-ID (because we need to placate some NNTP clients), we now display it as well, since that Message-ID could be the X-Alt-Message-ID that the reader is actually interested in. --- lib/PublicInbox/View.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 00bf38a9..39b04174 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -10,7 +10,7 @@ use bytes (); # only for bytes::length use PublicInbox::MsgTime qw(msg_datestamp); use PublicInbox::Hval qw/ascii_html obfuscate_addrs/; use PublicInbox::Linkify; -use PublicInbox::MID qw/id_compress mid_escape mids references/; +use PublicInbox::MID qw/id_compress mid_escape mids mids_for_index references/; use PublicInbox::MsgIter; use PublicInbox::Address; use PublicInbox::WwwStream; @@ -629,7 +629,7 @@ sub _msg_html_prepare { my $over = $ctx->{-inbox}->over; my $obfs_ibx = $ctx->{-obfs_ibx}; my $rv = ''; - my $mids = mids($hdr); + my $mids = mids_for_index($hdr); if ($nr == 0) { if ($more) { $rv .= @@ -691,9 +691,13 @@ sub _msg_html_prepare { $rv .= "Message-ID: <$mhtml> "; $rv .= "(raw)\n"; } else { + # X-Alt-Message-ID can happen if a message is injected from + # public-inbox-nntpd because of multiple Message-ID headers. my $lnk = PublicInbox::Linkify->new; my $s = ''; - $s .= "Message-ID: $_\n" for ($hdr->header_raw('Message-ID')); + for my $h (qw(Message-ID X-Alt-Message-ID)) { + $s .= "$h: $_\n" for ($hdr->header_raw($h)); + } $lnk->linkify_mids('..', \$s, 1); $rv .= $s; }