Skip to content

fix(imap): parse STATUS responses with an unquoted mailbox name - #290

Merged
robert-virkus merged 2 commits into
Enough-Software:mainfrom
hobleyd:fix/imap-status-unquoted-mailbox
Sep 26, 2026
Merged

robert-virkus merged 2 commits into
Enough-Software:mainfrom
hobleyd:fix/imap-status-unquoted-mailbox

Conversation

@hobleyd

@hobleyd hobleyd commented Sep 22, 2026

Copy link
Copy Markdown

Problem

StatusParser required the mailbox name to be double-quoted: RegExp(r'(STATUS "[^"]+?" )(.*)'). RFC 3501 allows the mailbox to be sent as an atom, and Dovecot does so (* STATUS INBOX (MESSAGES 231 UNSEEN 5 ...)), so the regex never matched and messagesExists/messagesUnseen/uidNext were silently left at 0 for every mailbox on such a server.

Fix

The regex accepts either a quoted string or an atom: (STATUS (?:"[^"]+?"|[^ (]+) )(.*). The existing test for a quoted name containing brackets still passes.

Tests

New test in status_parser_test.dart for STATUS INBOX (MESSAGES 231 UNSEEN 5 UIDNEXT 4392). Fails against main.

djhobley and others added 2 commits September 23, 2026 08:36
StatusParser required the mailbox name to be double-quoted
(`STATUS "INBOX" (...)`). RFC 3501 allows the name to be sent as an atom,
and Dovecot does so (`STATUS INBOX (...)`), so the regex never matched
and MESSAGES/UNSEEN/UIDNEXT were silently left at 0 for every mailbox.

The regex now accepts either a quoted string or an atom.
@robert-virkus
robert-virkus merged commit 5697e12 into Enough-Software:main Sep 26, 2026
1 check failed
@robert-virkus

Copy link
Copy Markdown
Member

<3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants