diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2018-02-26 16:14:50 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2018-03-01 10:34:56 -0800 |
commit | af3963d605a67a30074c3cd8baca355a7dfdec05 (patch) | |
tree | 53b9d97a35b998c82ff0e5cfacfaa890117c32bf /alot | |
parent | 4ba7a80a0c057dbc9081617b6703a0f75262459c (diff) |
possibly fix opening emails encoded as non-ascii/non-unicode
Diffstat (limited to 'alot')
-rw-r--r-- | alot/db/message.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/alot/db/message.py b/alot/db/message.py index 4c4af99b..2e1fef54 100644 --- a/alot/db/message.py +++ b/alot/db/message.py @@ -10,7 +10,8 @@ from datetime import datetime from notmuch import NullPointerError -from .utils import extract_body, message_from_file +from . import utils +from .utils import extract_body from .utils import decode_header from .attachment import Attachment from .. import helper @@ -101,8 +102,8 @@ class Message(object): "Message file is no longer accessible:\n%s" % path if not self._email: try: - with open(path) as f: - self._email = message_from_file(f) + with open(path, 'rb') as f: + self._email = utils.message_from_bytes(f.read()) except IOError: self._email = email.message_from_string(warning) return self._email |