]> Sergey Matveev's repositories - public-inbox.git/commitdiff
imap: fix multi-message partial header fetches
authorEric Wong <e@yhbt.net>
Wed, 10 Jun 2020 07:04:14 +0000 (07:04 +0000)
committerEric Wong <e@yhbt.net>
Sat, 13 Jun 2020 07:55:45 +0000 (07:55 +0000)
We must keep the contents of {-partial} around when handling
a request to fetch multiple messages.

lib/PublicInbox/IMAP.pm
t/imapd.t

index 4292c564f01423aa0bee1f74a620974c0963a570..fffd611b3c6ee5df0b9dce0eaf29231f46e9f2f6 100644 (file)
@@ -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");
index 59b95a6b83fdd0462c1dd6578c6e600125bb290d..fcbbdc09d316d719755ab4b517a95d7ef3be99e3 100644 (file)
--- 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 /,