summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-01-13 16:31:31 +0100
committerAnton Khirnov <anton@khirnov.net>2021-01-13 16:33:36 +0100
commit4baa4402d169d565977617505fffc59aade6dd23 (patch)
tree19fab118f188956eb6dd4caaa7a04be6b30a2721
parent13916b645f435a97803f4b0cbf86c426222d52f5 (diff)
widgets/thread: treat multipart/alternative with one subpart as mixed
Some systems create multipart/alternative emails with just one subpart. There is no point in drawing decorations for them, since there are no other alternatives to switch to, so treat them as mixed.
-rw-r--r--alot/widgets/thread.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/alot/widgets/thread.py b/alot/widgets/thread.py
index 3da660a5..b6eb31d5 100644
--- a/alot/widgets/thread.py
+++ b/alot/widgets/thread.py
@@ -372,7 +372,10 @@ def _handle_multipart(mime_tree, alternative_pref):
children.append(ch)
if len(children) > 0:
- if mime_tree.is_alternative:
+ # there exist some intelligence-challenged systems in the wild producing
+ # multipart/alternative with just a single alternative - treat those as
+ # mixed and so avoid displaying pointless decorations
+ if mime_tree.is_alternative and len(children) > 1:
return _MultiAltWidget(children, mime_tree.children, alternative_pref)
return _MultiMixedWidget(children)