Conversation
Two independent failures for a mailbox such as INBOX.Financial.Audit(s):
ListParser, for an extended LIST response (LIST-STATUS / LIST-EXTENDED
return options), found the extended-data block with indexOf('(') which
matched the '(' inside the quoted mailbox name. The name was truncated
(taking the closing quote with it), so the later quote-strip ate the
final character and the mailbox surfaced as 'Aud' at a path that did not
exist on the server. It now looks for the first '(' outside a
double-quoted string.
_encodeMailboxPath only quoted a path containing a space. RFC 3501
section 9 lists '(' ')' '{' among the atom-specials, so an unquoted
`COPY 1:3 INBOX.Audit(s)` (or SELECT, MOVE, CREATE, ...) is rejected by
servers with "BAD Invalid characters in atom". Those characters now
force quoting as a space does.
MockImapServer records what the client sends so tests can assert on the
command text actually written.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Two independent failures for a mailbox such as
INBOX.Financial.Audit(s)(seen against Dovecot):ListParser, for an extended LIST response (LIST-STATUS / LIST-EXTENDED return options,isExtended == true), located the extended-data block withlistDetails.indexOf('('). That matched the(inside the quoted mailbox name, sos)"was treated as extended data and the name was truncated, taking the closing quote with it. The later quote-strip then ate the final real character and the mailbox surfaced asAudat a path that did not exist on the server._encodeMailboxPathonly quoted a path when it contained a space. RFC 3501 section 9 lists(){among theatom-specials, so an unquotedCOPY 1:3 INBOX.Financial.Audit(s)(or SELECT, MOVE, CREATE, ...) is rejected by servers withBAD Invalid characters in atom. LIST was unaffected because it passesalwaysQuote: true.Fix
ListParserlooks for the first(that is outside a double-quoted string._encodeMailboxPathforces quoting when the encoded path contains(,)or{, as it already does for a space.MockImapServerrecords every chunk the client sends inrequests, so tests can assert on the command text actually written to the socket.Tests
Two new tests in
imap_client_test.dart: a LIST-STATUS response with"INBOX.Financial.Audit(s)"parses to the right name and path, andcopy(..., targetMailboxPath: 'INBOX.Financial.Audit(s)')sendsCOPY 1:3 "INBOX.Financial.Audit(s)". Both fail againstmain.