mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
#10004: in Q encoded word ignore '=xx' when xx is not valid hex.
Bug report and fix by Thomas Guettler.
This commit is contained in:
parent
9e88b5aeee
commit
31e984c39c
3 changed files with 10 additions and 1 deletions
|
@ -294,4 +294,4 @@ def header_decode(s):
|
||||||
the high level email.header class for that functionality.
|
the high level email.header class for that functionality.
|
||||||
"""
|
"""
|
||||||
s = s.replace('_', ' ')
|
s = s.replace('_', ' ')
|
||||||
return re.sub(r'=\w{2}', _unquote_match, s, re.ASCII)
|
return re.sub(r'=[a-fA-F0-9]{2}', _unquote_match, s, re.ASCII)
|
||||||
|
|
|
@ -1659,6 +1659,12 @@ Re: =?mac-iceland?q?r=8Aksm=9Arg=8Cs?= baz foo bar =?mac-iceland?q?r=8Aksm?=
|
||||||
dh = decode_header(s % q)
|
dh = decode_header(s % q)
|
||||||
self.assertEqual(dh, [(a, 'iso-8859-1')])
|
self.assertEqual(dh, [(a, 'iso-8859-1')])
|
||||||
|
|
||||||
|
def test_rfc2047_Q_invalid_digits(self):
|
||||||
|
# issue 10004.
|
||||||
|
s = '=?iso-8659-1?Q?andr=e9=zz?='
|
||||||
|
self.assertEqual(decode_header(s),
|
||||||
|
[(b'andr\xe9=zz', 'iso-8659-1')])
|
||||||
|
|
||||||
|
|
||||||
# Test the MIMEMessage class
|
# Test the MIMEMessage class
|
||||||
class TestMIMEMessage(TestEmailBase):
|
class TestMIMEMessage(TestEmailBase):
|
||||||
|
|
|
@ -79,6 +79,9 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #10004: quoprimime no longer generates a traceback when confronted
|
||||||
|
with invalid characters after '=' in a Q-encoded word.
|
||||||
|
|
||||||
- Issue #1491: BaseHTTPServer nows send a 100 Continue response before sending
|
- Issue #1491: BaseHTTPServer nows send a 100 Continue response before sending
|
||||||
a 200 OK for the Expect: 100-continue request header.
|
a 200 OK for the Expect: 100-continue request header.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue