Closed
Description
It is possible to receive an email that does not follow the specification, i. e. an email with the Content-Type header like
text/plain; charset=UTF-8; charset=UTF-8; format=flowed
Golang standard library does not allow duplicate media parameters so it is impossible to parse such a header. But two instances of the 'charset' parameter have the same value here, so it can be determined unambiguously.
I suggest making the mime.ParseMediaType function more tolerant to such errors. It should not stop the execution if it detected duplicate parameters have the same value. In order not to change behavior of any existing Go program, some special error value may be returned along with parsed media type and parameters.