Closed iredmail closed 2 years ago
We can't just do string operations like this, the syntax is much more complicated: https://datatracker.ietf.org/doc/html/rfc2045#section-5.1
Can we send a fix to upstream Go as well? Once that's done, I'm OK to merge a fix downstream to accommodate for older Go versions and avoid blocking on the Go team availability.
The modified function parseHeaderWithParams()
is used to parse header with parameters, and this PR focus on key=value
parameters, not cover all supported syntax. Is it ok?
I will try to send a fix to upstream, but not sure when it will get some attention or merged. :(
Will try to figure out a better workaround.
The modified function parseHeaderWithParams() is used to parse header with parameters, and this PR focus on key=value parameters, not cover all supported syntax. Is it ok?
No, it's not okay, because the function will not work for all Content-Type
header fields.
I will try to send a fix to upstream, but not sure when it will get some attention or merged. :(
That's fine, the important part is to send a patch upstream. Then we can backport it to go-message.
If nobody sends a patch upstream, upstream will have this issue forever.
Some mail header may contain duplicate parameter name, for example:
go-message reports
mime: duplicate parameter name
. This PR keeps the first one and remove duplicate ones like below, so that parsing header works well. Note: it doesn't modify original header.It's actually a Go mime package "issue", there's a proposal to handle it, but not accepted due to "Timed out in state WaitingForInfo": golang/go#28618 Also an open one: golang/go#47602
Since it's not that easy to push Go team to "fix" it, I suggest we use this PR as a workaround and make
go-message
more reliable.