From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) 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.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id CF5A81FAE5; Thu, 29 Mar 2018 10:28:29 +0000 (UTC) From: "Eric Wong (Contractor, The Linux Foundation)" To: meta@public-inbox.org Cc: "Eric Wong (Contractor, The Linux Foundation)" Subject: [PATCH 03/14] lookup by Message-ID favors the "primary" one Date: Thu, 29 Mar 2018 10:28:08 +0000 Message-Id: <20180329102819.15234-4-e@80x24.org> In-Reply-To: <20180329102819.15234-1-e@80x24.org> References: <20180329102819.15234-1-e@80x24.org> List-Id: The Message-ID mapped to an NNTP article number is stronger, so we will favor that for attachment lookups. --- lib/PublicInbox/Inbox.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm index 47b8630..4c7305f 100644 --- a/lib/PublicInbox/Inbox.pm +++ b/lib/PublicInbox/Inbox.pm @@ -298,9 +298,15 @@ sub msg_by_mid ($$;$) { my $srch = search($self) or return msg_by_path($self, mid2path($mid), $ref); my $smsg; - $srch->retry_reopen(sub { - $smsg = $srch->lookup_skeleton($mid) and $smsg->load_expand; - }); + # favor the Message-ID we used for the NNTP article number: + if (my $mm = mm($self)) { + my $num = $mm->num_for($mid); + $smsg = $srch->lookup_article($num); + } else { + $smsg = $srch->retry_reopen(sub { + $srch->lookup_skeleton($mid) and $smsg->load_expand; + }); + } $smsg ? msg_by_smsg($self, $smsg, $ref) : undef; } -- EW