From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] extmsg: avoid exceptions when /all/$MSGID/ fails
Date: Thu, 10 Dec 2020 23:04:50 +0000 [thread overview]
Message-ID: <20201210230450.6547-1-e@80x24.org> (raw)
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)) {
reply other threads:[~2020-12-10 23:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201210230450.6547-1-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).