mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-11 05:06:51 +00:00
fix(GODT-2966): Allow permissive parsing of MediaType parameters for import.
This commit is contained in:
@ -256,6 +256,10 @@ func DecodeCharset(original []byte, contentType string) ([]byte, error) {
|
||||
|
||||
// ParseMediaType from MIME doesn't support RFC2231 for non asci / utf8 encodings so we have to pre-parse it.
|
||||
func ParseMediaType(v string) (mediatype string, params map[string]string, err error) {
|
||||
v, _ = changeEncodingAndKeepLastParamDefinition(v)
|
||||
decoded, err := DecodeHeader(v)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
v, _ = changeEncodingAndKeepLastParamDefinition(decoded)
|
||||
return mime.ParseMediaType(v)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user