modoboa-webmail
modoboa-webmail copied to clipboard
ParseError due to unsupported flag
Emails that use a flag value without a leading \
or $
will cause an internal error:
ParseError: unexpected data_item found while looking for flag|right_parenthesis
Example: FLAGS (\Seen JUNK $Junk)
@awein Which version of the webmail do you use?
@tonioo Sorry for not mentioning the versions: Modoboa: 1.10.5 Webmail: 1.4.3
That's strange, the regex cleary allows this kind of token: https://github.com/modoboa/modoboa-webmail/blob/master/modoboa_webmail/lib/fetch_parser.py#L93
Sure - but JUNK
will be treated as data_item
type since it's matching that RE first. I had a quick look too but don't think there is an easy fix without reworking the Lexer
class.
This snippet should be enough to reproduce the issue:
FetchResponseParser().parse_chunk('1 (UID 1303 FLAGS (\Seen NOTJUNK $NotJunk) RFC822.SIZE 5710 BODYSTRUCTURE ("text" "plain" ("charset" "ISO-8859-15") NIL NIL "quoted-printable" 2634 56 NIL NIL NIL NIL) BODY[HEADER.FIELDS (DATE FROM TO CC SUBJECT)] {154}')
Indeed, there is a lexer rule conflict and the fix is more complicated than expected...