Skip to content

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

Open
hobleyd wants to merge 1 commit into
Enough-Software:mainfrom
hobleyd:fix/imap-status-unquoted-mailbox
Open

hobleyd wants to merge 1 commit 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.

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.
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.

2 participants