go-message icon indicating copy to clipboard operation
go-message copied to clipboard

Long quoted-printable lines break parsing

Open emersion opened this issue 4 years ago • 2 comments
trafficstars

Quoted-printable lines must have a length limit according to the RFC but some software doesn't do that. This ends up error'ing out in the stdlib's parser.

Tentiative fix in https://github.com/emersion/go-message/pull/120 was rejected.

emersion avatar Jun 18 '21 12:06 emersion

This also happens when you write a message instead of reading it. https://go.dev/play/p/NFGUFd02gnS

While it is correct that quoted-printable lines have a length limit the currently returned error bufio: buffer full makes it hard to pinpoint the problem when writing a multipart message.

Maybe the error message could be improved by returing a specific error to represent this problem.

Simerax avatar Oct 06 '22 10:10 Simerax

I've fixed this in our fork, open to a PR for it? I've had to copy the stdlib parser to fix it, and some other fixes in there for malformed mail I've seen in the wild trying to decode. Some are very specific and do slow down processing, so I was actually going to make a PR to allow setting of custom decoders, so I can stay up to date with upstream more easily. This one though is a very light touch.

Generally my rule is if outlook handles it, I'm going to try and find a way to do same. I do not handle writing errors, vast majority of my use case is reading.

Spiral90210 avatar Jan 25 '23 10:01 Spiral90210