[issue17369] Message.get_filename produces exception if the RFC2231 encoding is ill-formed

R. David Murray report at bugs.python.org
Wed Mar 6 23:25:40 CET 2013


New submission from R. David Murray:

>>> m = message_from_string("Content-Disposition: attachment; filename*0*="can't decode this filename")
>>> m.get_filename()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/rdmurray/python/p32/Lib/email/message.py", line 752, in get_filename
    return utils.collapse_rfc2231_value(filename).strip()
  File "/home/rdmurray/python/p32/Lib/email/utils.py", line 303, in collapse_rfc2231_value
    return str(rawbytes, charset, errors)
TypeError: str() argument 2 must be str, not None

----------
keywords: easy
messages: 183619
nosy: r.david.murray
priority: normal
severity: normal
stage: needs patch
status: open
title: Message.get_filename produces exception if the RFC2231 encoding is ill-formed
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17369>
_______________________________________


More information about the Python-bugs-list mailing list