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 5F8AA1FBD1 for ; Wed, 10 Jun 2020 07:05:22 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 17/82] imap: fix multi-message partial header fetches Date: Wed, 10 Jun 2020 07:04:14 +0000 Message-Id: <20200610070519.18252-18-e@yhbt.net> In-Reply-To: <20200610070519.18252-1-e@yhbt.net> References: <20200610070519.18252-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We must keep the contents of {-partial} around when handling a request to fetch multiple messages. --- lib/PublicInbox/IMAP.pm | 2 +- t/imapd.t | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm index 4292c564f01..fffd611b3c6 100644 --- a/lib/PublicInbox/IMAP.pm +++ b/lib/PublicInbox/IMAP.pm @@ -390,7 +390,7 @@ sub uid_fetch_cb { # called by git->cat_async $self->msg_more(' BODYSTRUCTURE '.fetch_body($eml, 1)); $want->{BODY} and $self->msg_more(' BODY '.fetch_body($eml)); - if (my $partial = delete $want->{-partial}) { + if (my $partial = $want->{-partial}) { partial_emit($self, $partial, $eml); } $self->msg_more(")\r\n"); diff --git a/t/imapd.t b/t/imapd.t index 59b95a6b83f..fcbbdc09d31 100644 --- a/t/imapd.t +++ b/t/imapd.t @@ -291,7 +291,7 @@ $pi_config->each_inbox(sub { qr/done_testing;(?:\r\n){1,2}\z/, 'BODY[2.1.2] tail matched'); - $ret = $mic->fetch_hash($uidnext, 'BODY[2.HEADER]') or + $ret = $mic->fetch_hash("1:$uidnext", 'BODY[2.HEADER]') or BAIL_OUT "2.HEADER $@"; like($ret->{$uidnext}->{'BODY[2.HEADER]'}, qr/\ADate: Sat, 18 Apr 2020 22:20:20 /,