aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--notmuch-reply.c7
-rwxr-xr-xtest/multipart2
-rwxr-xr-xtest/reply2
3 files changed, 7 insertions, 4 deletions
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 3b2b58d1..472a002e 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -537,9 +537,12 @@ create_reply_message(void *ctx,
"In-Reply-To", in_reply_to);
orig_references = notmuch_message_get_header (message, "references");
+ if (!orig_references)
+ /* Treat errors like missing References headers. */
+ orig_references = "";
references = talloc_asprintf (ctx, "%s%s%s",
- orig_references ? orig_references : "",
- orig_references ? " " : "",
+ *orig_references ? orig_references : "",
+ *orig_references ? " " : "",
in_reply_to);
g_mime_object_set_header (GMIME_OBJECT (reply),
"References", references);
diff --git a/test/multipart b/test/multipart
index c974226e..2033023a 100755
--- a/test/multipart
+++ b/test/multipart
@@ -599,7 +599,7 @@ cat <<EOF >EXPECTED
"From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
"To": "Carl Worth <cworth@cworth.org>, cworth@cworth.org",
"In-reply-to": "<87liy5ap00.fsf@yoom.home.cworth.org>",
- "References": " <87liy5ap00.fsf@yoom.home.cworth.org>"},
+ "References": "<87liy5ap00.fsf@yoom.home.cworth.org>"},
"original": {"id": "XXXXX",
"match": false,
"excluded": false,
diff --git a/test/reply b/test/reply
index c877ffe1..a85ebe56 100755
--- a/test/reply
+++ b/test/reply
@@ -242,7 +242,7 @@ test_expect_equal_json "$output" '
"reply-headers": {
"From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
"In-reply-to": "<'${gen_msg_id}'>",
- "References": " <'${gen_msg_id}'>",
+ "References": "<'${gen_msg_id}'>",
"Subject": "Re: \u00e0\u00df\u00e7",
"To": "\u2603 <snowman@example.com>"
}