You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
email: ValueError in get_section when parsing header with non-ASCII digit #87112
>>> import email.headerregistry
>>> reg = email.headerregistry.HeaderRegistry()
>>> h = reg('Content-Disposition', 'inline; 0*²')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.10/email/headerregistry.py", line 608, in __call__
return self[name](name, value)
File "/usr/lib/python3.10/email/headerregistry.py", line 196, in __new__
cls.parse(value, kwds)
File "/usr/lib/python3.10/email/headerregistry.py", line 452, in parse
kwds['parse_tree'] = parse_tree = cls.value_parser(value)
File "/usr/lib/python3.10/email/_header_value_parser.py", line 2705, in parse_content_disposition_header
disp_header.append(parse_mime_parameters(value[1:]))
File "/usr/lib/python3.10/email/_header_value_parser.py", line 2569, in parse_mime_parameters
token, value = get_parameter(value)
File "/usr/lib/python3.10/email/_header_value_parser.py", line 2431, in get_parameter
token, value = get_section(value)
File "/usr/lib/python3.10/email/_header_value_parser.py", line 2384, in get_section
section.number = int(digits)
ValueError: invalid literal for int() with base 10: '²'
This probably happens because:
>>> '²'.isdigit()
True
>>> int('²')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '²'
Activity
The-Compiler commentedon Jan 17, 2021
Found mostly by accident:
This probably happens because:
Fix coverage pragmas for Content-Disposition parsing