From d81de3e470fcc7407b117db0cea3f13e45eb5bdb Mon Sep 17 00:00:00 2001 From: Johannes Schauer Date: Thu, 17 Sep 2015 10:39:56 +0200 Subject: [PATCH] Re: [bug] notmuch requires Content-Disposition mime header value to be lower case --- 0d/80ab5b0a7ea11f50e3c0ddf7230d9e89a6957b | 217 ++++++++++++++++++++++ 1 file changed, 217 insertions(+) create mode 100644 0d/80ab5b0a7ea11f50e3c0ddf7230d9e89a6957b diff --git a/0d/80ab5b0a7ea11f50e3c0ddf7230d9e89a6957b b/0d/80ab5b0a7ea11f50e3c0ddf7230d9e89a6957b new file mode 100644 index 000000000..6a02ee27a --- /dev/null +++ b/0d/80ab5b0a7ea11f50e3c0ddf7230d9e89a6957b @@ -0,0 +1,217 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id F146A6DE021E + for ; Thu, 17 Sep 2015 01:39:59 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -2.503 +X-Spam-Level: +X-Spam-Status: No, score=-2.503 tagged_above=-999 required=5 + tests=[AWL=-2.503] autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id r7q1k47eu2jq for ; + Thu, 17 Sep 2015 01:39:57 -0700 (PDT) +Received: from fulda116.server4you.de (fulda116.server4you.de [62.75.219.19]) + by arlo.cworth.org (Postfix) with ESMTP id 797966DE0214 + for ; Thu, 17 Sep 2015 01:39:57 -0700 (PDT) +Received: from localhost (win7217.informatik.uni-wuerzburg.de [132.187.9.217]) + by mister-muffin.de (Postfix) with ESMTPSA id B6073802C3 + for ; Thu, 17 Sep 2015 10:39:56 +0200 (CEST) +Content-Type: multipart/signed; protocol="application/pgp-signature"; + micalg="pgp-sha256"; boundary="===============1041584664552388773==" +MIME-Version: 1.0 +Content-Disposition: inline +From: Johannes Schauer +User-Agent: alot/0.3.6 +To: notmuch@notmuchmail.org +References: <20150917070056.1941.94846@localhost> + <20150917083612.1941.22480@localhost> +In-Reply-To: <20150917083612.1941.22480@localhost> +Message-ID: <20150917083956.1941.35098@localhost> +Subject: Re: [bug] notmuch requires Content-Disposition mime header value to + be lower case +Date: Thu, 17 Sep 2015 10:39:56 +0200 +X-Mailman-Approved-At: Thu, 17 Sep 2015 07:43:13 -0700 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.18 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Thu, 17 Sep 2015 08:40:00 -0000 + +--===============1041584664552388773== +Content-Type: multipart/mixed; boundary="===============3884970403813133269==" +MIME-Version: 1.0 + +--===============3884970403813133269== +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: quoted-printable + +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=3Dflyer-vk-web.pdf +> > = + +> > but it works for: +> > = + +> > Content-Disposition: attachment; filename=3Dflyer-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 wi= +th +> > "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 =3D g_mime_object_get_content_disposition (part); +> if (disposition && +> - strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) = +=3D=3D 0) +> + strcasecmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMEN= +T) =3D=3D 0) +> { +> const char *filename =3D g_mime_part_get_filename (GMIME_PART (pa= +rt)); +> = + +> = + +> 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 t= +his. + +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 + +--===============3884970403813133269== +Content-Type: text/x-diff; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: attachment; + filename="0001-allow-case-insensitive-content-disposition-values.patch" + +From=208187076ab1ee9ce640cd15e9a214d49039b0f197 Mon Sep 17 00:00:00 2001 +From: Johannes 'josch' Schauer +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 =3D g_mime_object_get_content_disposition (part); + if (disposition && +- strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) =3D=3D 0) ++ strcasecmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) =3D= +=3D 0) + { + const char *filename =3D 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 <> ${MAIL_DIR}/multipart + = + + --=3D-=3D-=3D +-Content-Disposition: attachment; filename=3Dattachment ++Content-Disposition: ATTACHMENT; FILENAME=3Dattachment + = + + This is a text attachment. + = + +@@ -487,7 +487,7 @@ This is an embedded message, with a multipart/alternati= +ve part. + --=3D=3D-=3D-=3D=3D-- + = + + --=3D-=3D-=3D +-Content-Disposition: attachment; filename=3Dattachment ++Content-Disposition: ATTACHMENT; FILENAME=3Dattachment + = + + This is a text attachment. + = + +-- = + +2.5.1 + + +--===============3884970403813133269==-- + +--===============1041584664552388773== +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Description: signature +Content-Type: application/pgp-signature; name="signature.asc"; charset="us-ascii" + +-----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----- + +--===============1041584664552388773==-- -- 2.26.2