Skip to content

mime: Loosen the ParseMediaType error checking #13448

@cention-sany

Description

@cention-sany

What version of Go are you using (go version)? 1.5.1
What operating system and processor architecture are you using? Ubuntu Intel 64 bits
What did you do? use mime.ParseMediaType
What did you expect to see? error mime: invalid media parameter
What did you see instead? no error or different type of error

The following is actually output from bad email client for an attachment mime header:

Content-Type: application/octet-stream; name=Viktoria C
Content-Disposition: attachment; filename=Viktoria C

This type of header email will output "mime: invalid media parameter" error under golang. But the same email when open/parse by Thunderbird and other C email library will give the attachment with file name Viktoria instead of Viktoria C.

I understand the main problem is the bad email client and not golang library but the same mail can be opened with other application which is not using Golang library may give the wrong perspective that Golang library capability - the fact is Golang error handling too good that expose those scapegoat buggy software problem. But just because of this tiny error the whole email can not be parsed.

May be Golang library can have something as this to discriminate certain error that can be recovered.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions