From 7fe57f275eb808c237b33fb2750c0aec40fd3079 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 18 Oct 2023 19:36:43 +0200 Subject: [PATCH] Fix duplicated Inbox folder on IMAP servers that do not use Inbox folder with all capital letters (#9166) --- CHANGELOG.md | 1 + program/lib/Roundcube/rcube_imap_generic.php | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd03ea0e102..b8155f0761b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased - Fix PHP8 fatal error when parsing a malformed BODYSTRUCTURE (#9171) +- Fix duplicated Inbox folder on IMAP servers that do not use Inbox folder with all capital letters (#9166) ## Release 1.6.4 diff --git a/program/lib/Roundcube/rcube_imap_generic.php b/program/lib/Roundcube/rcube_imap_generic.php index 83d4ad0ad2c..afe7c23c7af 100644 --- a/program/lib/Roundcube/rcube_imap_generic.php +++ b/program/lib/Roundcube/rcube_imap_generic.php @@ -1650,6 +1650,18 @@ protected function _listMailboxes($ref, $mailbox, $subscribed = false, $return_o $mailbox = rtrim($mailbox, $delim); } + // Make it easier for the client to deal with INBOX folder + // by always returning the word with all capital letters + if (strlen($mailbox) == 5 + && ($mailbox[0] == 'i' || $mailbox[0] == 'I') + && ($mailbox[1] == 'n' || $mailbox[1] == 'N') + && ($mailbox[2] == 'b' || $mailbox[2] == 'B') + && ($mailbox[3] == 'o' || $mailbox[3] == 'O') + && ($mailbox[4] == 'x' || $mailbox[4] == 'X') + ) { + $mailbox = 'INBOX'; + } + // Add to result array if (!$lstatus) { $folders[] = $mailbox;