Open mmartin opened 4 years ago
I have a similar issue but presenting a different trace.. (also on a mail that was a 'blank' body - but had content in the attachments...
ERROR:ui:Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/alot-0.9.1-py3.9.egg/alot/ui.py", line 723, in apply_command
cmd.apply(self)
File "/usr/local/lib/python3.9/dist-packages/alot-0.9.1-py3.9.egg/alot/commands/search.py", line 43, in apply
tb.unfold_matching(query)
File "/usr/local/lib/python3.9/dist-packages/alot-0.9.1-py3.9.egg/alot/buffers/thread.py", line 341, in unfold_matching
MT.expand(MT.root)
File "/usr/local/lib/python3.9/dist-packages/alot-0.9.1-py3.9.egg/alot/widgets/thread.py", line 215, in expand
self.reassemble()
File "/usr/local/lib/python3.9/dist-packages/alot-0.9.1-py3.9.egg/alot/widgets/thread.py", line 189, in reassemble
self._maintree._treelist = self._assemble_structure()
File "/usr/local/lib/python3.9/dist-packages/alot-0.9.1-py3.9.egg/alot/widgets/thread.py", line 235, in _assemble_structure
bodytree = self._get_body()
File "/usr/local/lib/python3.9/dist-packages/alot-0.9.1-py3.9.egg/alot/widgets/thread.py", line 269, in _get_body
bodytxt = self._message.get_body_text()
File "/usr/local/lib/python3.9/dist-packages/alot-0.9.1-py3.9.egg/alot/db/message.py", line 287, in get_body_text
return extract_body_part(self.get_mime_part())
File "/usr/local/lib/python3.9/dist-packages/alot-0.9.1-py3.9.egg/alot/db/utils.py", line 499, in extract_body_part
**{'field_key': 'view'} if body_part.get_content_type() == 'text/plain'
AttributeError: 'str' object has no attribute 'get_content_type'
Software Versions
Describe the bug I received an e-mail without a body, just an attachment. Alot fails to open it.
Software Versions
To Reproduce Steps to reproduce the behaviour:
Error Log
This is due to this function:
https://github.com/pazz/alot/blob/32b885d07e8a32695fbb6ebd92a41a7052b148c3/alot/db/utils.py#L469-L491
Despite that
:rtype:
saysstr
, it normally returnsemail.message.EmailMessage
. And when there is no body it returns an empty string.Which fails in
https://github.com/pazz/alot/blob/32b885d07e8a32695fbb6ebd92a41a7052b148c3/alot/buffers/thread.py#L59-L60
via
https://github.com/pazz/alot/blob/32b885d07e8a32695fbb6ebd92a41a7052b148c3/alot/db/message.py#L277-L280