Skip to content

Commit

Permalink
restore lenient libmagic decoding
Browse files Browse the repository at this point in the history
176cffc ("refactor alot.db.utils.remove_cte", 2018-12-04) created a few
problems with 8bit quoted-printable e-mails, see #1291 #1360.

This commit restores the old libmagic fallback which did not cause this
problem.
  • Loading branch information
mjg committed Feb 4, 2019
1 parent fff58de commit b06210a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions alot/db/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,9 @@ def remove_cte(part, as_string=False):
sp = helper.try_decode(bp)
except UnicodeDecodeError as emsg:
# the mail contains chars that are not enc-encoded.
# try again and just ignore those
# libmagic works better than just ignoring those
logging.debug('Decoding failure: {}'.format(emsg))
sp = bp.decode(enc, errors='ignore')
sp = helper.try_decode(bp)
return sp
return bp

Expand Down

0 comments on commit b06210a

Please sign in to comment.