From: Johannes Schauer <josch@debian.org>
To: notmuch@notmuchmail.org
Subject: Re: [bug] notmuch requires Content-Disposition mime header value to be lower case
Date: Thu, 17 Sep 2015 10:39:56 +0200 [thread overview]
Message-ID: <20150917083956.1941.35098@localhost> (raw)
In-Reply-To: <20150917083612.1941.22480@localhost>
[-- Attachment #1.1: Type: text/plain, Size: 1502 bytes --]
Hi,
Quoting Johannes Schauer (2015-09-17 10:36:12)
> Quoting Johannes Schauer (2015-09-17 09:00:56)
> > it seems that notmuch does not put the attachment tag if:
> >
> > Content-Disposition: ATTACHMENT; FILENAME=flyer-vk-web.pdf
> >
> > but it works for:
> >
> > Content-Disposition: attachment; filename=flyer-vk-web.pdf
> >
> > But rfc1341 says that the value should be treated as case insensitive (section 2).
> >
> > I got an email with upper case Content-Disposition value in an email with
> > "User-Agent: Alpine 2.11 (LSU 23 2013-08-11)".
> >
> > Please CC me as I'm not subscribed - thanks!
>
> the fix seems to be to:
>
> --- a/lib/index.cc
> +++ b/lib/index.cc
> @@ -377,7 +377,7 @@ _index_mime_part (notmuch_message_t *message,
>
> disposition = g_mime_object_get_content_disposition (part);
> if (disposition &&
> - strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0)
> + strcasecmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0)
> {
> const char *filename = g_mime_part_get_filename (GMIME_PART (part));
>
>
> but then I saw that this was already done in your git.
whoops, I confused my local git repositories.
So the attached git format patch fixes the issue and adds a test case for this.
Funnily though there seem to be some weird newline differences that I cannot
explain, so I left them for somebody else to fix.
Thanks!
cheers, josch
[-- Attachment #1.2: 0001-allow-case-insensitive-content-disposition-values.patch --]
[-- Type: text/x-diff, Size: 1553 bytes --]
From 8187076ab1ee9ce640cd15e9a214d49039b0f197 Mon Sep 17 00:00:00 2001
From: Johannes 'josch' Schauer <josch@mister-muffin.de>
Date: Thu, 17 Sep 2015 10:39:29 +0200
Subject: [PATCH] allow case-insensitive content-disposition values
---
lib/index.cc | 2 +-
test/T190-multipart.sh | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/index.cc b/lib/index.cc
index e81aa81..34bab4e 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -377,7 +377,7 @@ _index_mime_part (notmuch_message_t *message,
disposition = g_mime_object_get_content_disposition (part);
if (disposition &&
- strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0)
+ strcasecmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0)
{
const char *filename = g_mime_part_get_filename (GMIME_PART (part));
diff --git a/test/T190-multipart.sh b/test/T190-multipart.sh
index 7c4c9f7..f16cc90 100755
--- a/test/T190-multipart.sh
+++ b/test/T190-multipart.sh
@@ -48,7 +48,7 @@ cat embedded_message >> ${MAIL_DIR}/multipart
cat <<EOF >> ${MAIL_DIR}/multipart
--=-=-=
-Content-Disposition: attachment; filename=attachment
+Content-Disposition: ATTACHMENT; FILENAME=attachment
This is a text attachment.
@@ -487,7 +487,7 @@ This is an embedded message, with a multipart/alternative part.
--==-=-==--
--=-=-=
-Content-Disposition: attachment; filename=attachment
+Content-Disposition: ATTACHMENT; FILENAME=attachment
This is a text attachment.
--
2.5.1
[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAABCAAGBQJV+nxcAAoJEPLLpcePvYPh1UUP/jAmxm4a0gq8rk2q58XjCI2c
fmoKHteMlr4WbhgjfU0UHDFyz1iSkjh/xMPCMWffO178mkpDHv8gK1mosvpC4go3
D8kApTrjoQBcSI09PzSqZh8NZyaYps/2gfUcY15M5szRR7OVSql3FsbSaDWt+oQk
Q4dGOgia101R17n95ENOxrA8kWB5THaeLC1FOx5IG+rYBsD1r7zrn8+JQZwHPvo7
jrfyBWD8IkgOwnBN+a39jt8f8KB2E+r6MHfor7BXhQt+DfhkFQhcBPUOZGmrIJzk
aztYI4k7eOszjvQI8ShgFappC4vE1gcGkawAtafwpUK3M7zRQjF7r9E8JWZObcLS
2ZeUjV+XhC1TVsXRlfA9Ol7M7IG0HSxxEo6Q3gB+B3g/nIpbOmnYWwggK+S9DSaT
3TYlHdTG3nXeiS0XK18uJzv3DiZO54ZLLeGHvp02Mhc3DAEYL8hPsX1+QXyZpWQB
N6KUbru79GCNolZOWzwemMXT8c5ptV9h9HbjIcaUZDoi/OpT25h7awzzYzq8/9Z/
ntMryD9H2DDcxuXqKOfQvhJJkwofaMyAIwrFEFoHEgDUdRRB/yJnmXjWTvZogHkd
TXiZSZ0f+UCrLgcEpOtajxgaJCaFZX9FXlVwWGjUYtL3YAzdJOLJ6FPK2iwy5nC2
HbJ35KmFXSZ2U38uO2O/
=1KBd
-----END PGP SIGNATURE-----
next parent reply other threads:[~2015-09-17 8:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20150917070056.1941.94846@localhost>
[not found] ` <20150917083612.1941.22480@localhost>
2015-09-17 8:39 ` Johannes Schauer [this message]
2015-09-18 12:03 ` [bug] notmuch requires Content-Disposition mime header value to be lower case David Bremner
2015-09-18 12:37 ` Johannes Schauer
2015-09-18 13:26 ` David Bremner
2015-09-26 8:59 ` Jani Nikula
2015-09-26 9:35 ` [PATCH 1/2] lib: content disposition values are not case-sensitive Jani Nikula
2015-09-26 9:35 ` [PATCH 2/2] cli: " Jani Nikula
2015-10-06 10:20 ` [WIP] tests: add test for case insensitive Content-Disposition David Bremner
2015-10-18 11:58 ` Jani Nikula
2015-10-18 12:05 ` Johannes Schauer
2015-11-19 11:57 ` [PATCH 1/2] lib: content disposition values are not case-sensitive David Bremner
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=20150917083956.1941.35098@localhost \
--to=josch@debian.org \
--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).