mime/quotedprintable: Read() returns error when underlying string ends with soft-break ("=") #15486
Labels
FrozenDueToAge
help wanted
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
go1.6.1 linux/amd64
https://play.golang.org/p/j9BAuXothm
The implementation of Read() in mime/quotedprintable/reader.go returns an error when the underlying string ends with an equals character ("="), indicating a soft-break:
quotedprintable: invalid bytes after =: ""
If I remove the last "=", it works great.
I am not familiar with all the details of RFC 2045, but I interpret point 3 on page 22 in the standard to say that the Go implementation technically is correct. But, as it says in point 2 on the same page, it would be more robust to accept it. Also note that these strings occur in the wild; the software that produced this particular string is:
X-Mailer: Apple Mail (2.3124)
I also take this into account (from mime/quotedprintable/reader.go, lines 73-76:
// Deviations from RFC 2045:
// 1. in addition to "=\r\n", "=\n" is also treated as soft line break.
// 2. it will pass through a '\r' or '\n' not preceded by '=', consistent
// with other broken QP encoders & decoders.
I would love it if Go was practical enough to add a point "3. it will pass though EoB preceeded by '=' due to broken QP encoders" as that will save a lot of edge cases and extra code further up the chain, but I understand If you disagree.
The text was updated successfully, but these errors were encountered: