Bugs item #1218081, was opened at 2005-06-10 06:07
Message generated for change (Comment added) made by bwarsaw
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: Closed
>Resolution: Fixed
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
>>>


----------------------------------------------------------------------

>Comment By: Barry A. Warsaw (bwarsaw)
Date: 2006-07-17 19:08

Message:
Logged In: YES 
user_id=12800

Fixed in r50692 in the Python 2.5 trunk.  I will back port
these changes to email 3.0 and 2.5.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1218081&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to