Skip to content

Commit

Permalink
fix regex for unquoting in decode_header
Browse files Browse the repository at this point in the history
issue #539
  • Loading branch information
TomasTomecek authored and pazz committed Jan 8, 2015
1 parent 70a8a33 commit f580e2b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion alot/db/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f580e2b

Please sign in to comment.