mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
Avoid giving GMime a NULL MIME-stream filter.
Micah Anderson reported an issue where a message failed to display in the emacs interface, (it instead gave an error, "json-read-string: Bad string format"). Micah tracked this down to the json output from "notmuch show" being interrupted by a GMime error message: gmime-CRITICAL **: g_mime_stream_filter_add: assertion `GMIME_IS_FILTER (filter) I tracked this down further to notmuch passing a NULL value to g_mime_stream_filter_add. And this was due to calling g_mime_filter_charset_new with a value of "unknown-8bit". So we add a test message withe a Conten-Type of "text/plain; charset=unknown-8bit" from Micah's message. Then we fix "notmuch show" to test for NULL before calling g_mime_stream_filter_add. Bug fixed.
This commit is contained in:
parent
42e146a3a2
commit
9c7668bdb5
2 changed files with 36 additions and 3 deletions
|
@ -225,9 +225,15 @@ show_part_content (GMimeObject *part, GMimeStream *stream_out)
|
|||
g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter),
|
||||
g_mime_filter_crlf_new(FALSE, FALSE));
|
||||
if (charset) {
|
||||
g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter),
|
||||
g_mime_filter_charset_new(charset, "UTF-8"));
|
||||
}
|
||||
GMimeFilter *charset_filter;
|
||||
charset_filter = g_mime_filter_charset_new(charset, "UTF-8");
|
||||
/* This result can be NULL for things like "unknown-8bit".
|
||||
* Don't set a NULL filter as that makes GMime print
|
||||
* annoying assertion-failure messages on stderr. */
|
||||
if (charset_filter)
|
||||
g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter),
|
||||
charset_filter);
|
||||
}
|
||||
}
|
||||
|
||||
wrapper = g_mime_part_get_content_object (GMIME_PART (part));
|
||||
|
|
|
@ -67,6 +67,7 @@ increment_mtime ()
|
|||
# [reply-to]=some-address
|
||||
# [in-reply-to]=<message-id>
|
||||
# [references]=<message-id>
|
||||
# [content-type]=content-type-specification
|
||||
# '[header]=full header line, including keyword'
|
||||
#
|
||||
# Additional values for email headers. If these are not provided
|
||||
|
@ -147,6 +148,11 @@ ${additional_headers}"
|
|||
${additional_headers}"
|
||||
fi
|
||||
|
||||
if [ ! -z "${template[content-type]}" ]; then
|
||||
additional_headers="Content-Type: ${template[content-type]}
|
||||
${additional_headers}"
|
||||
fi
|
||||
|
||||
|
||||
cat <<EOF >$gen_msg_filename
|
||||
From: ${template[from]}
|
||||
|
@ -1147,6 +1153,27 @@ printf " Ensure all messages were threaded together...\t"
|
|||
output=$($NOTMUCH search 'subject:"a ridiculously-long message ID"' | notmuch_search_sanitize)
|
||||
pass_if_equal "$output" "thread:XXX 2001-01-05 [1/3] Notmuch Test Suite; A ridiculously-long message ID (inbox unread)"
|
||||
|
||||
printf "\nTesting encoding issues...\n"
|
||||
printf " Message with text of unknown charset...\t"
|
||||
add_message '[content-type]="text/plain; charset=unknown-8bit"' \
|
||||
'[body]=irrelevant'
|
||||
|
||||
output=$($NOTMUCH show id:${gen_msg_id} 2>&1 | notmuch_show_sanitize)
|
||||
pass_if_equal "$output" "message{ id:msg-074@notmuch-test-suite depth:0 match:1 filename:/XXX/mail/msg-074
|
||||
header{
|
||||
Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox unread)
|
||||
Subject: Test message #74
|
||||
From: Notmuch Test Suite <test_suite@notmuchmail.org>
|
||||
To: Notmuch Test Suite <test_suite@notmuchmail.org>
|
||||
Date: Tue, 05 Jan 2001 15:43:57 -0800
|
||||
header}
|
||||
body{
|
||||
part{ ID: 1, Content-type: text/plain
|
||||
irrelevant
|
||||
part}
|
||||
body}
|
||||
message}"
|
||||
|
||||
echo ""
|
||||
echo "Notmuch test suite complete."
|
||||
|
||||
|
|
Loading…
Reference in a new issue