This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Incorrect RFC 2231 decoding
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: barry Nosy List: barry, raulcd
Priority: normal Keywords:

Created on 2005-01-15 16:13 by barry, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (1)
msg23973 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2005-01-15 16:13
The following message

---snip snip---
Content-Transfer-Encoding: base64
Content-Type: application/msword; x-mac-type=42494E41;
x-unix-mode=0644;
    x-mac-creator=4D535744;
    name="miriam's file.doc"
Content-Disposition: attachment;
    filename*0="miriam's file"; filename*1=ths.doc
---snip snip---

Is incorrectly decoded according to RFC 2231.  The bug
is in Utils.py in the decode_params() and
decode_rfc2231() functions.  charset/lang encoding
should only be present on the first parameter, i.e.
filename*0 and even then, the quoted single quote
should not trip up the scanner.  The problem is two fold:

- first, the unquoting of filename*0 happens in
decode_param(), too early for decode_rfc2231() to know
about it.  Second, the logic in docode_rfc2231() is too
naive; it should take quoting into account to decide
whether a single quote is part of the file name or part
of the leading charset/lang encoding.

I've labeled this in the Group: Python 2.4, but it
really affects Python 2.3 as well, and the current head.
History
Date User Action Args
2022-04-11 14:56:09adminsetgithub: 41444
2015-04-14 22:08:24raulcdsetnosy: + raulcd
2005-01-15 16:13:16barrycreate