diff options
author | R David Murray <rdmurray@bitdance.com> | 2014-02-07 20:04:26 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2014-02-07 20:04:26 (GMT) |
commit | c489e83432ef29c9c2a638c4ca290b308e5921e4 (patch) | |
tree | 37b9499524794f5aba72cc3d4a5df59d09306609 /Lib/test/test_email | |
parent | f1e953364ca4ee2715cbeaf85cc67a445770951e (diff) | |
parent | 1e949890f618867b7eabc1c08873611e960f5d03 (diff) | |
download | cpython-c489e83432ef29c9c2a638c4ca290b308e5921e4.zip cpython-c489e83432ef29c9c2a638c4ca290b308e5921e4.tar.gz cpython-c489e83432ef29c9c2a638c4ca290b308e5921e4.tar.bz2 |
Merge: #17369: Improve handling of broken RFC2231 values in get_filename.
Diffstat (limited to 'Lib/test/test_email')
-rw-r--r-- | Lib/test/test_email/test_email.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py index ce91476..31fd83a 100644 --- a/Lib/test/test_email/test_email.py +++ b/Lib/test/test_email/test_email.py @@ -5052,6 +5052,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 |