mime: fix issue with charset param

This commit is contained in:
dece 2021-05-24 20:10:04 +02:00
parent 4738e495b2
commit 8e4f8c4c70
2 changed files with 2 additions and 3 deletions

View file

@ -2,7 +2,6 @@ TODO
----------------------------------------
dumb rendering mode per site
well, preferences per site maybe?
does encoding really work? cf. egsam
more UT
setup.py

View file

@ -25,9 +25,9 @@ class MimeType:
def from_str(mime_string) -> Optional["MimeType"]:
"""Parse a MIME string into a MimeType instance, or None on error."""
if ";" in mime_string:
type_str, *parameters = mime_string.split(";")
type_str, *param_strs = mime_string.split(";")
parameters = {}
for param in map(lambda s: s.strip().lower(), parameters):
for param in map(lambda s: s.strip().lower(), param_strs):
if param.count("=") != 1:
return None
param_name, param_value = param.split("=")