Give a folder with an ampersand in its name its message count

FixEmailService
Shipped
September 2, 2026 at 7:50 AM UTC
Author
Kamo
Commit
5bd1e83

A mailbox called "Bugs & Enhancements" showed no count in the sidebar while every folder beside it showed the right one, and the mailbox totals were short by exactly that folder's contents. LIST-STATUS answers with a LIST line and a STATUS line per folder, and the two are joined by mailbox name. Both names arrive in modified UTF-7 and Jakarta Mail decodes both — ListInfo and Status each run theirs through BASE64MailboxDecoder. The join decoded the STATUS name a second time. That is a no-op for almost every name, which is why this went unnoticed, but "&" is modified UTF-7's shift character: the folder travels as "Bugs &- Enhancements", decodes once to "Bugs & Enhancements", and decodes again to mojibake. The lookup then missed and the folder was reported with zero messages. Join on the name as the library hands it over, falling back to the encoded form so the counts survive a mail library that stops decoding the STATUS side. Covered by the real wire data from the reported mailbox, where the folder holds 19 messages, plus a case for a STATUS name that arrived still encoded.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing