lib: content disposition values are not case-sensitive

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" tagging and filename term generation for
attachments while indexing.
This commit is contained in:
Jani Nikula 2015-09-26 12:35:21 +03:00 committed by David Bremner
parent c1c955786a
commit 506b81679a
2 changed files with 2 additions and 2 deletions

View file

@ -377,7 +377,8 @@ _index_mime_part (notmuch_message_t *message,
disposition = g_mime_object_get_content_disposition (part); disposition = g_mime_object_get_content_disposition (part);
if (disposition && 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 (part)); const char *filename = g_mime_part_get_filename (GMIME_PART (part));

View file

@ -764,7 +764,6 @@ output=$(notmuch search from:todd and mimetype:multipart/alternative | notmuch_s
test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd content types (inbox unread)" test_expect_equal "$output" "thread:XXX 2014-01-12 [1/1] Todd; odd content types (inbox unread)"
test_begin_subtest "case of Content-Disposition doesn't matter for indexing" test_begin_subtest "case of Content-Disposition doesn't matter for indexing"
test_subtest_known_broken
cat <<EOF > ${MAIL_DIR}/content-disposition cat <<EOF > ${MAIL_DIR}/content-disposition
Return-path: <david@tethera.net> Return-path: <david@tethera.net>
Envelope-to: david@tethera.net Envelope-to: david@tethera.net