Re: [bug] notmuch requires Content-Disposition mime header value to be lower case
authorJohannes Schauer <josch@debian.org>
Thu, 17 Sep 2015 08:39:56 +0000 (10:39 +0200)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:49:34 +0000 (14:49 -0700)
0d/80ab5b0a7ea11f50e3c0ddf7230d9e89a6957b [new file with mode: 0644]

diff --git a/0d/80ab5b0a7ea11f50e3c0ddf7230d9e89a6957b b/0d/80ab5b0a7ea11f50e3c0ddf7230d9e89a6957b
new file mode 100644 (file)
index 0000000..6a02ee2
--- /dev/null
@@ -0,0 +1,217 @@
+Return-Path: <josch@debian.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id F146A6DE021E\r
+ for <notmuch@notmuchmail.org>; Thu, 17 Sep 2015 01:39:59 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.503\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.503 tagged_above=-999 required=5\r
+ tests=[AWL=-2.503] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id r7q1k47eu2jq for <notmuch@notmuchmail.org>;\r
+ Thu, 17 Sep 2015 01:39:57 -0700 (PDT)\r
+Received: from fulda116.server4you.de (fulda116.server4you.de [62.75.219.19])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 797966DE0214\r
+ for <notmuch@notmuchmail.org>; Thu, 17 Sep 2015 01:39:57 -0700 (PDT)\r
+Received: from localhost (win7217.informatik.uni-wuerzburg.de [132.187.9.217])\r
+ by mister-muffin.de (Postfix) with ESMTPSA id B6073802C3\r
+ for <notmuch@notmuchmail.org>; Thu, 17 Sep 2015 10:39:56 +0200 (CEST)\r
+Content-Type: multipart/signed; protocol="application/pgp-signature";\r
+ micalg="pgp-sha256"; boundary="===============1041584664552388773=="\r
+MIME-Version: 1.0\r
+Content-Disposition: inline\r
+From: Johannes Schauer <josch@debian.org>\r
+User-Agent: alot/0.3.6\r
+To: notmuch@notmuchmail.org\r
+References: <20150917070056.1941.94846@localhost>\r
+ <20150917083612.1941.22480@localhost>\r
+In-Reply-To: <20150917083612.1941.22480@localhost>\r
+Message-ID: <20150917083956.1941.35098@localhost>\r
+Subject: Re: [bug] notmuch requires Content-Disposition mime header value to\r
+ be lower case\r
+Date: Thu, 17 Sep 2015 10:39:56 +0200\r
+X-Mailman-Approved-At: Thu, 17 Sep 2015 07:43:13 -0700\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 17 Sep 2015 08:40:00 -0000\r
+\r
+--===============1041584664552388773==\r
+Content-Type: multipart/mixed; boundary="===============3884970403813133269=="\r
+MIME-Version: 1.0\r
+\r
+--===============3884970403813133269==\r
+Content-Type: text/plain; charset="utf-8"\r
+MIME-Version: 1.0\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+Hi,\r
+\r
+Quoting Johannes Schauer (2015-09-17 10:36:12)\r
+> Quoting Johannes Schauer (2015-09-17 09:00:56)\r
+> > it seems that notmuch does not put the attachment tag if:\r
+> > =\r
+\r
+> >         Content-Disposition: ATTACHMENT; FILENAME=3Dflyer-vk-web.pdf\r
+> > =\r
+\r
+> > but it works for:\r
+> > =\r
+\r
+> >         Content-Disposition: attachment; filename=3Dflyer-vk-web.pdf\r
+> > =\r
+\r
+> > But rfc1341 says that the value should be treated as case insensitive (=\r
+section 2).\r
+> > =\r
+\r
+> > I got an email with upper case Content-Disposition value in an email wi=\r
+th\r
+> > "User-Agent: Alpine 2.11 (LSU 23 2013-08-11)".\r
+> > =\r
+\r
+> > Please CC me as I'm not subscribed - thanks!\r
+> =\r
+\r
+> the fix seems to be to:\r
+> =\r
+\r
+> --- a/lib/index.cc\r
+> +++ b/lib/index.cc\r
+> @@ -377,7 +377,7 @@ _index_mime_part (notmuch_message_t *message,\r
+>  =\r
+\r
+>      disposition =3D g_mime_object_get_content_disposition (part);\r
+>      if (disposition &&\r
+> -       strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) =\r
+=3D=3D 0)\r
+> +       strcasecmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMEN=\r
+T) =3D=3D 0)\r
+>      {\r
+>         const char *filename =3D g_mime_part_get_filename (GMIME_PART (pa=\r
+rt));\r
+>  =\r
+\r
+> =\r
+\r
+> but then I saw that this was already done in your git.\r
+\r
+whoops, I confused my local git repositories.\r
+\r
+So the attached git format patch fixes the issue and adds a test case for t=\r
+his.\r
+\r
+Funnily though there seem to be some weird newline differences that I cannot\r
+explain, so I left them for somebody else to fix.\r
+\r
+Thanks!\r
+\r
+cheers, josch\r
+\r
+--===============3884970403813133269==\r
+Content-Type: text/x-diff; charset="utf-8"\r
+MIME-Version: 1.0\r
+Content-Transfer-Encoding: quoted-printable\r
+Content-Disposition: attachment;\r
+ filename="0001-allow-case-insensitive-content-disposition-values.patch"\r
+\r
+From=208187076ab1ee9ce640cd15e9a214d49039b0f197 Mon Sep 17 00:00:00 2001\r
+From: Johannes 'josch' Schauer <josch@mister-muffin.de>\r
+Date: Thu, 17 Sep 2015 10:39:29 +0200\r
+Subject: [PATCH] allow case-insensitive content-disposition values\r
+\r
+---\r
+ lib/index.cc           | 2 +-\r
+ test/T190-multipart.sh | 4 ++--\r
+ 2 files changed, 3 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/lib/index.cc b/lib/index.cc\r
+index e81aa81..34bab4e 100644\r
+--- a/lib/index.cc\r
++++ b/lib/index.cc\r
+@@ -377,7 +377,7 @@ _index_mime_part (notmuch_message_t *message,\r
+ =\r
+\r
+     disposition =3D g_mime_object_get_content_disposition (part);\r
+     if (disposition &&\r
+-      strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) =3D=3D 0)\r
++      strcasecmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) =3D=\r
+=3D 0)\r
+     {\r
+       const char *filename =3D g_mime_part_get_filename (GMIME_PART (part));\r
+ =\r
+\r
+diff --git a/test/T190-multipart.sh b/test/T190-multipart.sh\r
+index 7c4c9f7..f16cc90 100755\r
+--- a/test/T190-multipart.sh\r
++++ b/test/T190-multipart.sh\r
+@@ -48,7 +48,7 @@ cat embedded_message >> ${MAIL_DIR}/multipart\r
+ cat <<EOF >> ${MAIL_DIR}/multipart\r
+ =\r
+\r
+ --=3D-=3D-=3D\r
+-Content-Disposition: attachment; filename=3Dattachment\r
++Content-Disposition: ATTACHMENT; FILENAME=3Dattachment\r
+ =\r
+\r
+ This is a text attachment.\r
+ =\r
+\r
+@@ -487,7 +487,7 @@ This is an embedded message, with a multipart/alternati=\r
+ve part.\r
+ --=3D=3D-=3D-=3D=3D--\r
+ =\r
+\r
+ --=3D-=3D-=3D\r
+-Content-Disposition: attachment; filename=3Dattachment\r
++Content-Disposition: ATTACHMENT; FILENAME=3Dattachment\r
+ =\r
+\r
+ This is a text attachment.\r
+ =\r
+\r
+-- =\r
+\r
+2.5.1\r
+\r
+\r
+--===============3884970403813133269==--\r
+\r
+--===============1041584664552388773==\r
+MIME-Version: 1.0\r
+Content-Transfer-Encoding: 7bit\r
+Content-Description: signature\r
+Content-Type: application/pgp-signature; name="signature.asc"; charset="us-ascii"\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v2\r
+\r
+iQIcBAABCAAGBQJV+nxcAAoJEPLLpcePvYPh1UUP/jAmxm4a0gq8rk2q58XjCI2c\r
+fmoKHteMlr4WbhgjfU0UHDFyz1iSkjh/xMPCMWffO178mkpDHv8gK1mosvpC4go3\r
+D8kApTrjoQBcSI09PzSqZh8NZyaYps/2gfUcY15M5szRR7OVSql3FsbSaDWt+oQk\r
+Q4dGOgia101R17n95ENOxrA8kWB5THaeLC1FOx5IG+rYBsD1r7zrn8+JQZwHPvo7\r
+jrfyBWD8IkgOwnBN+a39jt8f8KB2E+r6MHfor7BXhQt+DfhkFQhcBPUOZGmrIJzk\r
+aztYI4k7eOszjvQI8ShgFappC4vE1gcGkawAtafwpUK3M7zRQjF7r9E8JWZObcLS\r
+2ZeUjV+XhC1TVsXRlfA9Ol7M7IG0HSxxEo6Q3gB+B3g/nIpbOmnYWwggK+S9DSaT\r
+3TYlHdTG3nXeiS0XK18uJzv3DiZO54ZLLeGHvp02Mhc3DAEYL8hPsX1+QXyZpWQB\r
+N6KUbru79GCNolZOWzwemMXT8c5ptV9h9HbjIcaUZDoi/OpT25h7awzzYzq8/9Z/\r
+ntMryD9H2DDcxuXqKOfQvhJJkwofaMyAIwrFEFoHEgDUdRRB/yJnmXjWTvZogHkd\r
+TXiZSZ0f+UCrLgcEpOtajxgaJCaFZX9FXlVwWGjUYtL3YAzdJOLJ6FPK2iwy5nC2\r
+HbJ35KmFXSZ2U38uO2O/\r
+=1KBd\r
+-----END PGP SIGNATURE-----\r
+\r
+--===============1041584664552388773==--\r