unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
To: Notmuch Mail <notmuch@notmuchmail.org>
Subject: [PATCH] emacs/notmuch-show: Work around errors where a part lacks a content-type
Date: Sun,  3 Jan 2021 13:31:54 -0500	[thread overview]
Message-ID: <20210103183154.1207696-1-dkg@fifthhorseman.net> (raw)
In-Reply-To: <87wnwu8tzf.fsf@fifthhorseman.net>

This is an inadequate workaround to the concerns raised in
id:87wnwu8tzf.fsf@fifthhorseman.net -- when it is installed, a
particular kind of malformed message (in particular, one containing a
message/rfc822 part that is improperly transfer-encoded with base64)
won't break the rendering.

However, with this applied, there are definitely still problems.

For example, the rendering of such a message shows internal errors for
me:

    [ attachment.eml: message/rfc822 ]

    !!! Bodypart handler `notmuch-show-insert-part-message/rfc822' threw an error:
    !!! Wrong type argument: char-or-string-p, nil
    !!! Bodypart handler `notmuch-show-insert-part-*/*' threw an error:
    !!! Symbol’s value as variable is void: gnus-newsgroup-charset

But it's better than causing the whole thread to fail to render.

I don't know what the right solution is, so i'm offering this
workaround in the spirit of harm reduction.

(note: this is on the "release" branch -- this function has changed in
master, so i don't think it applies there, but i haven't tested further)
---
 emacs/notmuch-show.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index b08ceb97..625a5d55 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -575,7 +575,9 @@ message at DEPTH in the current thread."
       (push (list content-id msg part) notmuch-show--cids)))
   ;; Recurse on sub-parts
   (let ((ctype (notmuch-split-content-type
-		(downcase (plist-get part :content-type)))))
+		(downcase (if (plist-get part :content-type)
+                              (plist-get part :content-type)
+                            "text/plain")))))
     (cond ((equal (car ctype) "multipart")
 	   (mapc (apply-partially #'notmuch-show--register-cids msg)
 		 (plist-get part :content)))
-- 
2.29.2\r

  reply	other threads:[~2021-01-03 18:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-31 23:44 failure in emacs notmuch-show: notmuch-show--register-cids: Wrong type argument: char-or-string-p, nil Daniel Kahn Gillmor
2021-01-02  9:47 ` Jonas Bernoulli
2021-01-03  5:33   ` Daniel Kahn Gillmor
2021-01-03 18:31     ` Daniel Kahn Gillmor [this message]
2021-01-03 20:06       ` [PATCH] emacs/notmuch-show: Work around errors where a part lacks a content-type Tomi Ollila
2021-01-04 21:07         ` Jonas Bernoulli
2021-01-05 22:00           ` Daniel Kahn Gillmor
2021-01-10 18:38             ` Jonas Bernoulli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210103183154.1207696-1-dkg@fifthhorseman.net \
    --to=dkg@fifthhorseman.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).