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 2D6BF1FBC2 for ; Wed, 10 Jun 2020 07:06:28 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 48/82] imap: STATUS and LIST are case-insensitive, too Date: Wed, 10 Jun 2020 07:04:45 +0000 Message-Id: <20200610070519.18252-49-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: Some clients insist on sending "INBOX" in all caps, since it's special in RFC 3501. --- lib/PublicInbox/IMAP.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm index 5865822f0c3..8c6fa7b62c9 100644 --- a/lib/PublicInbox/IMAP.pm +++ b/lib/PublicInbox/IMAP.pm @@ -537,7 +537,7 @@ sub uid_fetch_m { # long_response sub cmd_status ($$$;@) { my ($self, $tag, $mailbox, @items) = @_; - my $ibx = $self->{imapd}->{mailboxes}->{$mailbox} or + my $ibx = $self->{imapd}->{mailboxes}->{lc $mailbox} or return "$tag NO Mailbox doesn't exist: $mailbox\r\n"; return "$tag BAD no items\r\n" if !scalar(@items); ($items[0] !~ s/\A\(//s || $items[-1] !~ s/\)\z//s) and @@ -571,7 +571,8 @@ sub cmd_list ($$$$) { # request for hierarchy delimiter $l = [ qq[* LIST (\\Noselect) "." ""\r\n] ]; } elsif ($refname ne '' || $wildcard ne '*') { - $wildcard =~ s!([^a-z0-9_])!$patmap{$1} // "\Q$1"!eig; + $wildcard = lc $wildcard; + $wildcard =~ s!([^a-z0-9_])!$patmap{$1} // "\Q$1"!eg; $l = [ grep(/ \Q$refname\E$wildcard\r\n\z/s, @$l) ]; } \(join('', @$l, "$tag OK List done\r\n"));