From fbc8993e32794a3f7dde5220a2ff683657bf7dab Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 12 May 2023 19:10:19 +1000 Subject: [PATCH] notmuch: handle display of alternatives that are multipart. An alternative can be multipart, e.g. multipart/related. In that case it won't be the last segment of the path which says "alternative". We have to look earlier. Signed-off-by: NeilBrown --- DOC/TODO.md | 2 +- python/module-notmuch.py | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/DOC/TODO.md b/DOC/TODO.md index 292164da..68753f6b 100644 --- a/DOC/TODO.md +++ b/DOC/TODO.md @@ -35,7 +35,7 @@ Bugs to be fixed - [X] line break in 0 and p[i].endswith(":0") and + not p[i].startswith("alternative:")): + # Might be the first part of a multi-path alternative, + # look earlier in the path + i -= 1 + edlib.LOG("consider", p, i, ) + if p[i].startswith("alternative:"): # this is one of several - can we handle it? - group = ','.join(p[:-1]) - this = p[-1][12:] + group = ','.join(p[:i]) + this = p[i][12:] if type in ['text/plain', 'text/calendar', 'text/rfc822-headers', 'message/rfc822']: choose[group] = this -- 2.39.5