Skip to content

Commit

Permalink
Fix duplicated Inbox folder on IMAP servers that do not use Inbox fol…
Browse files Browse the repository at this point in the history
…der with all capital letters (#9166)
  • Loading branch information
alecpl committed Oct 18, 2023
1 parent 522562a commit 7fe57f2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 12 additions & 0 deletions program/lib/Roundcube/rcube_imap_generic.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7fe57f2

Please sign in to comment.