summaryrefslogtreecommitdiff
path: root/alot/db
diff options
context:
space:
mode:
authorTomas Tomecek <ttomecek@redhat.com>2014-08-06 18:19:27 +0200
committerPatrick Totzke <patricktotzke@gmail.com>2015-01-08 22:36:16 +0000
commitf580e2b168d633d34f1c6f9838f59f98dbd93463 (patch)
tree7edea6614504c0cbea925c801fc6c3589bff2d70 /alot/db
parent70a8a33aad48089d96ddd5cca2ee211980b0e425 (diff)
fix regex for unquoting in decode_header
issue #539
Diffstat (limited to 'alot/db')
-rw-r--r--alot/db/utils.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/alot/db/utils.py b/alot/db/utils.py
index bea7b0c6..5250577c 100644
--- a/alot/db/utils.py
+++ b/alot/db/utils.py
@@ -357,7 +357,10 @@ def decode_header(header, normalize=False):
# some mailers send out incorrectly escaped headers
# and double quote the escaped realname part again. remove those
- value = re.sub(r'\"(.*?=\?.*?.*?)\"', r'\1', value)
+ # RFC: 2047
+ regex = r'"(=\?.+?\?.+?\?[^ ?]+\?=)"'
+ value = re.sub(regex, r'\1', value)
+ logging.debug("unquoted header: |%s|", value)
# otherwise we interpret RFC2822 encoding escape sequences
valuelist = email.header.decode_header(value)