Closed issuefiler closed 4 years ago
TL; DR: MimeHeaderDecode
not collapsing encoded-word
separators.
The email of ID 8d62ebc4c6a8ded43a4b553a5013be1d@grr.la
. The space isn’t supposed to be there.
Subject: =?iso-2022-jp?B?GyRCIVpLXEZ8Om89fCFbPEIkT0lUOk5NUSROJU0lPyROSn0bKEI=?= =?iso-2022-jp?B?GyRCJCxCPyQkJEckORsoQg==?=
Thanks.
Todo:
MimeHeaderDecode
to consume the linear white-space and not preserve it. (Add an additional state that consumes it) See #202
MimeHeaderDecode
has been reworked. It now skips any space/tabs if another encoded-word is ahead. (Also, optimized it not to allocate any buffers if no encoded words are found. Also eliminated the WriteByte(byte) calls!)
From RFC-822:
From RFC-2047:
encoded-word
s can be separated by any amount oflinear-space-white
and suchlinear-space-white
s are ignored when decoding.Problem
When an email header is given as follows,
go-guerrilla
givesabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789
, when the correct reading isabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
.Causes
ReadMIMEHeader
puts a space unfolding folded email headers.https://github.com/flashmob/go-guerrilla/blob/51f7dda326b1e9878e5f679ccb34a134127951b0/mail/envelope.go#L135-L140
MimeHeaderDecode
doesn’t separateencoded-word
s bylinear-space-white
s but a singleSPACE
(Line #233), and always preserve such separators (Line #240).https://github.com/flashmob/go-guerrilla/blob/51f7dda326b1e9878e5f679ccb34a134127951b0/mail/envelope.go#L233-L240