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=-3.7 required=3.0 tests=ALL_TRUSTED,AWL,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 3BDC91F4B4 for ; Thu, 10 Dec 2020 23:04:50 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] extmsg: avoid exceptions when /all/$MSGID/ fails Date: Thu, 10 Dec 2020 23:04:50 +0000 Message-Id: <20201210230450.6547-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: If a message can't be found in ->ALL, we shouldn't attempt to enter code paths which iterate normal inboxes or attempt to access non-existent fields (e.g. {name}, {newsgroup}, {inboxdir}) in the ExtSearch object. --- lib/PublicInbox/ExtMsg.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/ExtMsg.pm b/lib/PublicInbox/ExtMsg.pm index 8da96df6..6a173f67 100644 --- a/lib/PublicInbox/ExtMsg.pm +++ b/lib/PublicInbox/ExtMsg.pm @@ -107,7 +107,8 @@ sub ext_msg_ALL ($) { my ($ctx) = @_; my $ALL = $ctx->{www}->{pi_cfg}->ALL or return; my $by_eidx_key = $ctx->{www}->{pi_cfg}->{-by_eidx_key}; - my $cur_key = $ctx->{ibx}->eidx_key; + my $cur_key = eval { $ctx->{ibx}->eidx_key } // + return partial_response($ctx); # $cur->{ibx} == $ALL my %seen = ($cur_key => 1); my ($id, $prev); while (my $x = $ALL->over->next_by_mid($ctx->{mid}, \$id, \$prev)) {