Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restore lenient libmagic decoding #1375

Merged
merged 1 commit into from
Feb 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
1 change: 0 additions & 1 deletion tests/db/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,6 @@ def test_require_mailcap_file(self):

self.assertEqual(actual, expected)

@unittest.expectedFailure
def test_simple_utf8_file(self):
mail = email.message_from_binary_file(
open('tests/static/mail/utf8.eml', 'rb'))
Expand Down