unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
To: Jonas Bernoulli <jonas@bernoul.li>,
	Tomi Ollila <tomi.ollila@iki.fi>,
	Notmuch Mail <notmuch@notmuchmail.org>
Subject: Re: [PATCH] emacs/notmuch-show: Work around errors where a part lacks a content-type
Date: Tue, 05 Jan 2021 17:00:41 -0500	[thread overview]
Message-ID: <87y2h76o3a.fsf@fifthhorseman.net> (raw)
In-Reply-To: <87im8c9zru.fsf@bernoul.li>


[-- Attachment #1.1: Type: text/plain, Size: 1414 bytes --]

On Mon 2021-01-04 22:07:49 +0100, Jonas Bernoulli wrote:
> There are other places in the elisp code where the `:content-type' is
> assumed to be a string, so fixing it just here doesn't cut it.  To fix
> it for everyone, "notmuch show..." should probably take care of falling
> back to some sane default if the type cannot be determined.

the only two "sane defaults" would be either "text/plain" or
"application/octet-stream", but the circumstances in which they are
appropriate might differ.  e.g. a the top level of a message (or the top
level of a message/rfc822 subpart), the "sane default" would be
"text/plain" (because that's how messages by MIME-ignorant mailers look,
and they should still be readable text).  But a subpart without a
Content-Type designation should maybe default to
"application/octet-stream", or (even fancier) maybe a guess based on
other part headers, discovered filenames, or by sniffing content (yikes,
there be dragons).

All that said, i think fixing all the places in the elisp code is the
safer route, because the elisp code can't guarantee what the local
version of notmuch will do.  At the very least, if :content-type isn't a
string, notmuch-show shouldn't choke and break the rendering of the
thread.

So i think we should identify all the places where :content-type is
expected to be a string, and degrade gracefully if that is not how the
field is populated.

      --dkg

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2021-01-06  4:13 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     ` [PATCH] emacs/notmuch-show: Work around errors where a part lacks a content-type Daniel Kahn Gillmor
2021-01-03 20:06       ` Tomi Ollila
2021-01-04 21:07         ` Jonas Bernoulli
2021-01-05 22:00           ` Daniel Kahn Gillmor [this message]
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=87y2h76o3a.fsf@fifthhorseman.net \
    --to=dkg@fifthhorseman.net \
    --cc=jonas@bernoul.li \
    --cc=notmuch@notmuchmail.org \
    --cc=tomi.ollila@iki.fi \
    /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).