diff options
author | R David Murray <rdmurray@bitdance.com> | 2014-02-07 15:02:19 -0500 |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2014-02-07 15:02:19 -0500 |
commit | 664d51591aacf6c1cf19f4da46c298a8789bbbe9 (patch) | |
tree | 98310c82bae4c82dc07b214c937fce186ec9dddb /Lib/test/test_email/test_email.py | |
parent | 1e257bcddbeee8b5e026aff47ea02863332dd899 (diff) | |
download | cpython-664d51591aacf6c1cf19f4da46c298a8789bbbe9.tar.gz |
#17369: Improve handling of broken RFC2231 values in get_filename.
This fixes a regression relative to python2.
Diffstat (limited to 'Lib/test/test_email/test_email.py')
-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 c787695e12..4157a067a2 100644 --- a/Lib/test/test_email/test_email.py +++ b/Lib/test/test_email/test_email.py @@ -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 |