HaskellNet icon indicating copy to clipboard operation
HaskellNet copied to clipboard

IMAP.status doesn't work when mailbox name contains a space

Open mpscholten opened this issue 1 year ago • 1 comments

The pStatusLine parser parses until it hits a space. When we have a mailbox like [Gmail]/Alle Nachrichten, it will not consume the full mailbox name

mpscholten avatar Nov 21 '24 01:11 mpscholten

@qnikst could you take a look at this? (and if you're on this maybe also the other open PR) :)

mpscholten avatar Jan 26 '25 22:01 mpscholten

Hello! Thanks for the patch, but I expect that it would need some more love, but correct me if I'm wrong.

I was not able to get through all the RFC, but I expect that in case if mailbox has special characters like spaces it MUST be quoted, and if there is already a double quote in the protocol it has to be escaped by the \ symbol. If this is correct then the current approach is only a partial solution: it does indeed fix the case of spaces, but does not fix it for the case if there are double quotes in the mailbox.

If you already have a good system to test and check the fix can you please try that case?

qnikst avatar Jun 08 '25 07:06 qnikst

I'd suggest using something like:

unquote `manyTill` char '"' ... where
  unquote = asum [ char '\' >> anyChar, anyChar]

This way we will be able to consume a quoted double quote and return it from the parser and will not stop before we needed.

qnikst avatar Jun 08 '25 07:06 qnikst