diff options
author | Barry Warsaw <barry@python.org> | 2001-10-25 22:43:46 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2001-10-25 22:43:46 (GMT) |
commit | 2539cf5aadd5c7d6ceb6e8db36c98ed83ca62b48 (patch) | |
tree | f739416fd490819f86fc025dd55a4d1597e2638a /Lib | |
parent | e674ca737dc65a14ef8b417d198727a744e8d84c (diff) | |
download | cpython-2539cf5aadd5c7d6ceb6e8db36c98ed83ca62b48.zip cpython-2539cf5aadd5c7d6ceb6e8db36c98ed83ca62b48.tar.gz cpython-2539cf5aadd5c7d6ceb6e8db36c98ed83ca62b48.tar.bz2 |
A fix for SF bug #472560, extra newlines returned by get_param() when
the separating semi-colon shows up on a continuation line (legal, but
weird).
Bug reported and fixed by Matthew Cowles. Test case and sample email
included.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/email/Message.py | 2 | ||||
-rw-r--r-- | Lib/test/data/msg_22.txt | 46 | ||||
-rw-r--r-- | Lib/test/test_email.py | 4 |
3 files changed, 51 insertions, 1 deletions
diff --git a/Lib/email/Message.py b/Lib/email/Message.py index 00efbcc..6f0db85 100644 --- a/Lib/email/Message.py +++ b/Lib/email/Message.py @@ -17,7 +17,7 @@ import Errors import Utils SEMISPACE = '; ' -paramre = re.compile(r';\s*') +paramre = re.compile(r'\s*;\s*') diff --git a/Lib/test/data/msg_22.txt b/Lib/test/data/msg_22.txt new file mode 100644 index 0000000..af9de5f --- /dev/null +++ b/Lib/test/data/msg_22.txt @@ -0,0 +1,46 @@ +Mime-Version: 1.0 +Message-Id: <a05001902b7f1c33773e9@[134.84.183.138]> +Date: Tue, 16 Oct 2001 13:59:25 +0300 +To: a@example.com +From: b@example.com +Content-Type: multipart/mixed; boundary="============_-1208892523==_============" + +--============_-1208892523==_============ +Content-Type: text/plain; charset="us-ascii" ; format="flowed" + +Text text text. +--============_-1208892523==_============ +Content-Id: <a05001902b7f1c33773e9@[134.84.183.138].0.0> +Content-Type: image/jpeg; name="wibble.JPG" + ; x-mac-type="4A504547" + ; x-mac-creator="474B4F4E" +Content-Disposition: attachment; filename="wibble.JPG" +Content-Transfer-Encoding: base64 + +/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB +AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAALCAXABIEBAREA +g6bCjjw/pIZSjO6FWFpldjySOmCNrO7DBZibUXhTwtCixw+GtAijVdqxxaPp0aKvmGXa +qrbBQvms0mAMeYS/3iTV1dG0hHaRNK01XblnWxtVdjkHLMIgTyqnk9VB7CrP2KzIINpa +4O7I+zxYO9WV8jZg71Zlb+8rMDkEirAVQFAUAKAFAAAUAYAUDgADgY6DjpRtXj5RxjHA +4wQRj0wQCMdCAewpaKKK/9k= +--============_-1208892523==_============ +Content-Id: <a05001902b7f1c33773e9@[134.84.183.138].0.1> +Content-Type: image/jpeg; name="wibble2.JPG" + ; x-mac-type="4A504547" + ; x-mac-creator="474B4F4E" +Content-Disposition: attachment; filename="wibble2.JPG" +Content-Transfer-Encoding: base64 + +/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB +AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAALCAXABJ0BAREA +/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA +W6NFJJBEkU10kKGTcWMDwxuU+0JHvk8qAtOpNwqSR0n8c3BlDyXHlqsUltHEiTvdXLxR +7vMiGDNJAJWkAMk8ZkCFp5G2oo5W++INrbQtNfTQxJAuXlupz9oS4d5Y1W+E2XlWZJJE +Y7LWYQxTLE1zuMbfBPxw8X2fibVdIbSbI6nLZxX635t9TjtYreWR7WGKJTLJFFKSlozO +0ShxIXM43uC3/9k= +--============_-1208892523==_============ +Content-Type: text/plain; charset="us-ascii" ; format="flowed" + +Text text text. +--============_-1208892523==_============-- + diff --git a/Lib/test/test_email.py b/Lib/test/test_email.py index b2dfce4..d397c09 100644 --- a/Lib/test/test_email.py +++ b/Lib/test/test_email.py @@ -218,6 +218,10 @@ class TestMessageAPI(TestEmailBase): eq(msg.get_param('bar', header='x-header'), 'one') eq(msg.get_param('baz', header='x-header'), 'two') + def test_get_param_funky_continuation_lines(self): + msg = self._msgobj('msg_22.txt') + self.assertEqual(msg.get_payload(1).get_param('name'), 'wibble.JPG') + def test_has_key(self): msg = email.message_from_string('Header: exists') self.failUnless(msg.has_key('header')) |