Make Gmail's folders open, and list them as folders rather than paths

Fixkamo-internal
Shipped
September 5, 2026 at 6:32 AM UTC
Author
Kamo
Commit
85bc03b

Two faults, both from the client deciding for itself things only the mail server knows. **"Failed to load messages."** The folder travelled as a path segment, and Gmail separates its hierarchy with "/" — its Sent folder is `[Gmail]/Sent Mail`. Encoded once, the %2F is refused by Tomcat and by Spring Security's StrictHttpFirewall with 400 Bad Request, before any handler runs; encoded twice, so is the %25. The request never reached the mail code at all, which is why the message was the generic one. The name now travels in the query string, where neither rule applies and one layer of encodeURIComponent is exact. The proxy was undoing the encoding besides: Next decodes the segments it hands a route as `params`, so rebuilding the upstream path from them turned the folder's own slash into a path separator and produced four segments where the route has three. It now forwards a slice of the original pathname. **Every folder under "My folders", labelled with its whole path.** The tree split paths on "." and decided what was a system folder by matching leaf names against SENT / DRAFTS / TRASH. Neither holds outside Dovecot: Gmail separates with "/" and calls them "Sent Mail" and "Spam". So nothing nested, nothing was recognised, and GUARANTEED_FOLDERS then added a "Sent" that did not exist — the one a member would naturally click. EmailService now reports each folder's separator and its RFC 6154 role, and both the sidebar and the move picker use them: a role pins its folder to the fixed block wherever it sits in the tree, and suppresses the stand-in that would otherwise be invented for it. A tree cached in a browser by an older build carries neither field, so the old name-matching still applies to it and nothing reshuffles on the first load.

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