cli: content disposition values are not case-sensitive
authorJani Nikula <jani@nikula.org>
Sat, 26 Sep 2015 09:35:22 +0000 (12:35 +0300)
committerDavid Bremner <david@tethera.net>
Thu, 19 Nov 2015 11:47:29 +0000 (07:47 -0400)
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
notmuch-show.c

index 1357142903d5771566678a132f15c6537e4e7714..6df54fc992bb39b2f61e115b83f53555e05c00a0 100644 (file)
@@ -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));
index 5a83c6056ca5de85ef52b5dbb64359904dbba1a4..87e52bbc0e81a7f8b0c4c7ca5c374cfdbb5da068 100644 (file)
@@ -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";