[PATCH 2/2] cli: content disposition values are not case-sensitive
authorJani Nikula <jani@nikula.org>
Sat, 26 Sep 2015 09:35:22 +0000 (12:35 +0300)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:49:38 +0000 (14:49 -0700)
9c/8145c253a0943c024daed9b40a9a0431b44afb [new file with mode: 0644]

diff --git a/9c/8145c253a0943c024daed9b40a9a0431b44afb b/9c/8145c253a0943c024daed9b40a9a0431b44afb
new file mode 100644 (file)
index 0000000..69d919a
--- /dev/null
@@ -0,0 +1,109 @@
+Return-Path: <jani@nikula.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 1EEFB6DE0AC2\r
+ for <notmuch@notmuchmail.org>; Sat, 26 Sep 2015 02:37:58 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.525\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.525 tagged_above=-999 required=5 tests=[AWL=0.195,\r
+  RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01]\r
+ 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 x3xhwB26Ci5z for <notmuch@notmuchmail.org>;\r
+ Sat, 26 Sep 2015 02:37:56 -0700 (PDT)\r
+Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com\r
+ [209.85.212.177])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 0BA1C6DE0924\r
+ for <notmuch@notmuchmail.org>; Sat, 26 Sep 2015 02:35:46 -0700 (PDT)\r
+Received: by wicfx3 with SMTP id fx3so45966927wic.0\r
+ for <notmuch@notmuchmail.org>; Sat, 26 Sep 2015 02:35:44 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to\r
+ :references;\r
+ bh=PwqranSoydLzjdKWu/KDIpCokQ7PcNlES/UWaDGtTxo=;\r
+ b=jbVc0j5c1vVCuffuxhwGw95JAQJ0bD3GkYTzlhBkS2VfXzcCnJWbHT4y6+vQsdLADG\r
+ /K2W5LUZkUOHip29AA4vk3O+oYuMSRqBsKD6F5tV7tsEYh0II9YIr8rTXAM2A5QHe3Q3\r
+ oTXzo9cYQeoExHTLuwMOF4xizD+wEqXWmgKfZ2+FrfeI0DGslmVrO/WrrMsJmvn/s0Sc\r
+ vd0IzDWGu/w8t1Dq07KhDwwJpjiEcBfWarDchwbiwjbyat3Di5exsZTAQARN/cAquCA5\r
+ oyqI9cP6g4WqQGSHzkQ7xSEt9IqqvcVIE5XnngsAhr9T6wagG9Sx51ApMANADQh1IwKr\r
+ Lvpw==\r
+X-Gm-Message-State:\r
+ ALoCoQkIFW5ur23jIf5OBAsG1oSbWpAffnMotV+aiaoVIKf2vVjqX5sCG4QeDtALc7sNrd7dnyJ0\r
+X-Received: by 10.180.8.106 with SMTP id q10mr7434830wia.92.1443260144320;\r
+ Sat, 26 Sep 2015 02:35:44 -0700 (PDT)\r
+Received: from localhost (mobile-access-bcee63-221.dhcp.inet.fi.\r
+ [188.238.99.221])\r
+ by smtp.gmail.com with ESMTPSA id fs9sm7437735wic.24.2015.09.26.02.35.43\r
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Sat, 26 Sep 2015 02:35:43 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: David Bremner <david@tethera.net>, Johannes Schauer <josch@debian.org>,\r
+ notmuch@notmuchmail.org\r
+Subject: [PATCH 2/2] cli: content disposition values are not case-sensitive\r
+Date: Sat, 26 Sep 2015 12:35:22 +0300\r
+Message-Id: <1443260122-5122-2-git-send-email-jani@nikula.org>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <1443260122-5122-1-git-send-email-jani@nikula.org>\r
+References: <871tdvvoyf.fsf@tesseract.cs.unb.ca>\r
+ <1443260122-5122-1-git-send-email-jani@nikula.org>\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: Sat, 26 Sep 2015 09:37:58 -0000\r
+\r
+Per RFC 2183, the values for Content-Disposition values are not\r
+case-sensitive. While at it, use the gmime function for getting at the\r
+disposition string instead of referencing the field directly.\r
+\r
+This fixes attachment display and quoting in notmuch show and reply,\r
+respectively.\r
+---\r
+ notmuch-reply.c | 3 ++-\r
+ notmuch-show.c  | 3 ++-\r
+ 2 files changed, 4 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/notmuch-reply.c b/notmuch-reply.c\r
+index fd6a1ec1b11d..437c4ed5acc2 100644\r
+--- a/notmuch-reply.c\r
++++ b/notmuch-reply.c\r
+@@ -80,7 +80,8 @@ format_part_reply (mime_node_t *node)\r
+           show_text_part_content (node->part, stream_stdout, NOTMUCH_SHOW_TEXT_PART_REPLY);\r
+           g_object_unref(stream_stdout);\r
+       } else if (disposition &&\r
+-                 strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0) {\r
++                 strcasecmp (g_mime_content_disposition_get_disposition (disposition),\r
++                             GMIME_DISPOSITION_ATTACHMENT) == 0) {\r
+           const char *filename = g_mime_part_get_filename (GMIME_PART (node->part));\r
+           printf ("Attachment: %s (%s)\n", filename,\r
+                   g_mime_content_type_to_string (content_type));\r
+diff --git a/notmuch-show.c b/notmuch-show.c\r
+index e05480899b33..e9f4dffe0877 100644\r
+--- a/notmuch-show.c\r
++++ b/notmuch-show.c\r
+@@ -456,7 +456,8 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,\r
+           g_mime_part_get_filename (GMIME_PART (node->part)) : NULL;\r
\r
+       if (disposition &&\r
+-          strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0)\r
++          strcasecmp (g_mime_content_disposition_get_disposition (disposition),\r
++                      GMIME_DISPOSITION_ATTACHMENT) == 0)\r
+           part_type = "attachment";\r
+       else\r
+           part_type = "part";\r
+-- \r
+2.1.4\r
+\r