diff options
author | pacien <pacien.trangirard@pacien.net> | 2019-11-23 21:55:53 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2019-11-23 22:04:44 +0000 |
commit | 59227e42199066ee5759abf681aff468ed05a4c8 (patch) | |
tree | 3057285ecbbca7ac3811c4e67956b81ec6fc8bea | |
parent | 50c0b5ed7a3c23eb17fcbda3fc6151691311502a (diff) |
envelope: fix header key:value parsing regression
Fixes an issue introduced in 45829f7956716638fe77989a50eb87d3ea34cace
which made header values containing ':' break the parser.
-rw-r--r-- | alot/db/envelope.py | 2 | ||||
-rw-r--r-- | tests/db/test_envelope.py | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/alot/db/envelope.py b/alot/db/envelope.py index 1852bae1..7e08289c 100644 --- a/alot/db/envelope.py +++ b/alot/db/envelope.py @@ -315,7 +315,7 @@ class Envelope: # locally, lines are separated by a simple LF, not CRLF # we decode the edited text ourselves here as # email.message_from_file can't deal with raw utf8 header values - headerRe = re.compile(r'^(?P<k>.+):(?P<v>(.|\n[ \t\r\f\v])+)$', + headerRe = re.compile(r'^(?P<k>.+?):(?P<v>(.|\n[ \t\r\f\v])+)$', re.MULTILINE) for header in headerRe.finditer(raw): if header.start() > headerEndPos + 1: diff --git a/tests/db/test_envelope.py b/tests/db/test_envelope.py index b7612f37..86e481bf 100644 --- a/tests/db/test_envelope.py +++ b/tests/db/test_envelope.py @@ -94,7 +94,7 @@ class TestEnvelope(unittest.TestCase): 'From: foo@example.com\n' 'To: bar@example.com,\n' ' baz@example.com\n' - 'Subject: Test email\n' + 'Subject: Fwd: Test email\n' '\n' 'Some body content: which is not a header.\n' ) @@ -103,7 +103,7 @@ class TestEnvelope(unittest.TestCase): self.assertDictEqual(envlp.headers, { 'From': ['foo@example.com'], 'To': ['bar@example.com, baz@example.com'], - 'Subject': ['Test email'] + 'Subject': ['Fwd: Test email'] }) self.assertEqual(envlp.body, 'Some body content: which is not a header.') |