Quote and encode IMAP mailbox names#108
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aaa892f8bd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| -> IO [(MailboxStatus, Integer)] | ||
| status conn mbox stats = | ||
| let cmd = "STATUS " ++ mbox ++ " (" ++ (unwords $ map show stats) ++ ")" | ||
| let cmd = "STATUS " ++ quoteMailboxName mbox ++ " (" ++ (unwords $ map show stats) ++ ")" |
There was a problem hiding this comment.
Parse quoted STATUS mailbox names
When mbox contains a space, this now sends a valid quoted STATUS command, but conforming servers echo that mailbox as a string, e.g. * STATUS "foo bar" (...); pStatusLine still discards the name with anyChar manyTill space, so it stops inside the quoted name and then fails to parse the stats. In that scenario status conn "foo bar" ... throws a parse error instead of returning the status; the parser needs to consume an IMAP astring/quoted mailbox before the status list.
Useful? React with 👍 / 👎.
cbfe450 to
0e242d9
Compare
Draft follow-up for IMAP mailbox handling. This is based directly on current upstream
masterand intentionally kept separate from #101.Changes:
SELECT,EXAMINE,CREATE,DELETE,RENAME,SUBSCRIBE,UNSUBSCRIBE,STATUS,APPEND,COPY,MOVE)LIST/LSUBimap-parserstest suiteSource-Repositoryfromgit://tohttps://so currentcabal checkpassesRegression coverage:
Entwürfe->Entw&APw-rfeA&B->A&-BEntw&APw-rfeandA&-BBefore wiring the fix,
cabal test imap-parsers --test-show-details=directfailed on the new command-byte and LIST decoding tests.Validation:
nix shell nixpkgs#cabal-install nixpkgs#ghc --command cabal test imap-parsers --test-show-details=directnix shell nixpkgs#cabal-install nixpkgs#ghc --command cabal build allnix shell nixpkgs#cabal-install nixpkgs#ghc --command cabal check(only the existingCHANGELOGdoc-place warning remains)git diff --checkNote: this draft includes the same
imap-parserstest-target setup andhttps://repository metadata fix as #101 because it is independently based on upstreammaster. Once #101 merges, this branch can be rebased to drop that overlap.