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