imap-server icon indicating copy to clipboard operation
imap-server copied to clipboard

cmdFetch expected literal parens around final argument to FETCH

Open wathiede opened this issue 10 years ago • 1 comments

When mutt attempts to fetch the body of a message, the client sends:

C: a0006 UID FETCH 10 BODY.PEEK[]

Which doesn't match the pattern in conn/commands.go:

    registerCommand("((?i)UID )?(?i:FETCH) ("+sequenceSet+") \\(([A-z0-9\\s\\(\\)\\[\\]\\.-]+)\\)", cmdFetch)

Do you have a client that has explicit parens around the 'BODY.PEEK[]' part? I'm not seeing anything to that effect in http://tools.ietf.org/html/rfc3501#section-6.4.5

PS, you may want to check out string literals specified with backticks instead of double-quotes when writing regexps. It saves on some of the backslash escaping.

wathiede avatar Oct 13 '15 03:10 wathiede

There should be more sophisticated parser. Especially to implement SEARCH command. This cannot be achieved with ordered regex above. And there are more uncovered RFC scenarios. e.g. Aside the asterisk "*", there can be also "%" for non-recursive list(via RFC3501). Implementing something like this https://github.com/paulrosania/go-imap instead of regex could be helpful

mysuf avatar Dec 30 '15 18:12 mysuf