[ python-Bugs-1218081 ] email.Utils.py: "'" in RFC2231 header
SourceForge.net
noreply at sourceforge.net
Fri Jun 10 12:08:19 CEST 2005
Bugs item #1218081, was opened at 2005-06-10 10:07
Message generated for change (Settings changed) made by tkikuchi
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1218081&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Tokio Kikuchi (tkikuchi)
>Assigned to: Barry A. Warsaw (bwarsaw)
Summary: email.Utils.py: "'" in RFC2231 header
Initial Comment:
A header like this one can cause ValueError in
attempting to decode the RFC2231 format:
Content-Disposition: inline;
filename*0="Today's Headlines- C.I.A. Is
Reviewing Its Security Policy
for R"; filename*1="ecruiting Translators.jpg"
Note that there is a ' in the filename. MUA should
have escaped the ' by %27 but Python email library
should be robust for such a violation.
Here is the traceback:
>>> print p[4]['content-disposition']
inline;
filename*0="Today's Headlines- C.I.A. Is
Reviewing Its Security Policy
for R"; filename*1="ecruiting Translators.jpg"
>>> p[4].get_filename()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.4/email/Message.py",
line 707, in get_filename
filename = self.get_param('filename', missing,
'content-disposition')
File "/usr/local/lib/python2.4/email/Message.py",
line 590, in get_param
for k, v in self._get_params_preserve(failobj, header):
File "/usr/local/lib/python2.4/email/Message.py",
line 537, in _get_params_pre
serve
params = Utils.decode_params(params)
File "/usr/local/lib/python2.4/email/Utils.py", line
275, in decode_params
charset, language, value =
decode_rfc2231(EMPTYSTRING.join(value))
File "/usr/local/lib/python2.4/email/Utils.py", line
222, in decode_rfc2231
charset, language, s = parts
ValueError: need more than 2 values to unpack
>>>
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1218081&group_id=5470
More information about the Python-bugs-list
mailing list