Skip to content

mime: allow duplicate media parameters with equal values #48866

Closed
@iredmail

Description

@iredmail

[This is a duplicate proposal of #28618, but it's closed due to Timed out in state WaitingForInfo. and doesn't accept further discussion.]

Some mail user agent (MUA) (incorrectly) generates mail header with duplicate parameter names, this is the one i received recently (duplicate boundary):

Content-Type: multipart/alternative; boundary="----RTIR0GV26TDW15Q5CVX979LBL6XN18"; boundary="----RTIR0GV26TDW15Q5CVX979LBL6XN18"

Golang standard library mime.ParseMediaType() does not allow duplicate media parameters so it is impossible to parse such a header (it returns error mime: duplicate parameter name).

I suggest making the mime.ParseMediaType() function more tolerant to such errors, for example, just use the first value and ignore the rest. At least it should not stop the execution if duplicate parameters have the same value.


See also:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions