mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
#17369: Improve handling of broken RFC2231 values in get_filename.
This fixes a regression relative to python2.
This commit is contained in:
parent
bd3a11ba34
commit
1e949890f6
3 changed files with 28 additions and 0 deletions
|
@ -5018,6 +5018,26 @@ Content-Type: application/x-foo; name*0=\"Frank's\"; name*1=\" Document\"
|
|||
self.assertNotIsInstance(param, tuple)
|
||||
self.assertEqual(param, "Frank's Document")
|
||||
|
||||
def test_rfc2231_missing_tick(self):
|
||||
m = '''\
|
||||
Content-Disposition: inline;
|
||||
\tfilename*0*="'This%20is%20broken";
|
||||
'''
|
||||
msg = email.message_from_string(m)
|
||||
self.assertEqual(
|
||||
msg.get_filename(),
|
||||
"'This is broken")
|
||||
|
||||
def test_rfc2231_missing_tick_with_encoded_non_ascii(self):
|
||||
m = '''\
|
||||
Content-Disposition: inline;
|
||||
\tfilename*0*="'This%20is%E2broken";
|
||||
'''
|
||||
msg = email.message_from_string(m)
|
||||
self.assertEqual(
|
||||
msg.get_filename(),
|
||||
"'This is\ufffdbroken")
|
||||
|
||||
# test_headerregistry.TestContentTypeHeader.rfc2231_single_quote_in_value_with_charset_and_lang
|
||||
def test_rfc2231_tick_attack_extended(self):
|
||||
eq = self.assertEqual
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue