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
From 8187076ab1ee9ce640cd15e9a214d49039b0f197 Mon Sep 17 00:00:00 2001
From: Johannes 'josch' Schauer <jo...@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: signature.asc
Description: signature

_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to