go-imap
go-imap copied to clipboard
imapwire: expected SP, got ")" when parsing bodystructure
Getting error: in response-data: in body-type-mpart: in body-type-1part: imapwire: expected SP, got ")" when attempting to parse the following bodystructure:
T3 UID FETCH 120732 (BODYSTRUCTURE)
* 17 FETCH (UID 120732 BODYSTRUCTURE (("ALTERNATIVE" ("BOUNDARY" "e7e3f78cb2203c4e50561d13c480670d46c0bb5ccba09400aae9c221fc41") NIL NIL)("APPLICATION" "PDF" NIL NIL NIL "BASE64" 1476806 NIL ("ATTACHMENT" ("FILENAME" "investing-101.pdf")) NIL) "MIXED" ("BOUNDARY" "7b1fa0fc24c33f620e26ce902dcf2ecbcc7ba56cd9e042624b2ee60b9d56") NIL NIL))
Looks like it's getting stuck on the ALTERNATIVE statement. Been looking at the decoder so may PR a fix if I can figure it out.
Indeed, seems like the server meant to send the ALTERNATIVE part as a body-type-mpart. However, it doesn't comply with the RFC, because it sends zero child parts:
body-type-mpart = 1*body SP media-subtype
[SP body-ext-mpart]