From: Austin Clements Date: Mon, 12 Aug 2013 18:40:38 +0000 (+2000) Subject: [PATCH 5/6] reply: Remove extraneous space from generated References X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8f09ca46994fffe58531529ae31cb8073d823c4e;p=notmuch-archives.git [PATCH 5/6] reply: Remove extraneous space from generated References --- diff --git a/97/636727e3a6c5bcaa771d6b9c1d4bfc874b7c13 b/97/636727e3a6c5bcaa771d6b9c1d4bfc874b7c13 new file mode 100644 index 000000000..d5cab9d79 --- /dev/null +++ b/97/636727e3a6c5bcaa771d6b9c1d4bfc874b7c13 @@ -0,0 +1,126 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 425CB431FAE + for ; Mon, 12 Aug 2013 11:41:03 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id cnZ0d3GbmTdM for ; + Mon, 12 Aug 2013 11:40:58 -0700 (PDT) +Received: from dmz-mailsec-scanner-2.mit.edu (dmz-mailsec-scanner-2.mit.edu + [18.9.25.13]) + by olra.theworths.org (Postfix) with ESMTP id 76E65431FBC + for ; Mon, 12 Aug 2013 11:40:53 -0700 (PDT) +X-AuditID: 1209190d-b7f078e000000937-98-52092c343689 +Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) + by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP + id 6D.46.02359.43C29025; Mon, 12 Aug 2013 14:40:52 -0400 (EDT) +Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) + by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id r7CIeqRp011677; + Mon, 12 Aug 2013 14:40:52 -0400 +Received: from drake.dyndns.org (26-4-172.dynamic.csail.mit.edu [18.26.4.172]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r7CIemRi003750 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Mon, 12 Aug 2013 14:40:50 -0400 +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1V8x2u-0005yg-Nf; Mon, 12 Aug 2013 14:40:48 -0400 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH 5/6] reply: Remove extraneous space from generated References +Date: Mon, 12 Aug 2013 14:40:38 -0400 +Message-Id: <1376332839-22825-6-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.10.4 +In-Reply-To: <1376332839-22825-1-git-send-email-amdragon@mit.edu> +References: <1376332839-22825-1-git-send-email-amdragon@mit.edu> +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFtrHIsWRmVeSWpSXmKPExsUixG6nomuiwxlkcPSvqcX1mzOZHRg9nq26 + xRzAGMVlk5Kak1mWWqRvl8CVMWPhM+aCDoGKDQefszcwfuPpYuTkkBAwkfh8sp0VwhaTuHBv + PVsXIxeHkMA+Rok1e7azQzgbGSVO9V1lAqkSEjjCJPH+FydEYi6jxNxJ/9hBEmwCGhLb9i9n + BLFFBKQldt6dDTSWg4NZQE3iT5cKSFhYwFdiwfQWsBIWAVWJT99vgrXyCjhIrG5bAHWFokT3 + swlsIDangKPE/eXnWCD2Okhs3NXDOIGRfwEjwypG2ZTcKt3cxMyc4tRk3eLkxLy81CJdI73c + zBK91JTSTYygoOGU5N3B+O6g0iFGAQ5GJR7ejI8cQUKsiWXFlbmHGCU5mJREeSdpcgYJ8SXl + p1RmJBZnxBeV5qQWH2KU4GBWEuHdwgqU401JrKxKLcqHSUlzsCiJ8z59ejZQSCA9sSQ1OzW1 + ILUIJivDwaEkwRuqDdQoWJSanlqRlplTgpBm4uAEGc4DNNwdpIa3uCAxtzgzHSJ/ilGX48Lh + hZ8YhVjy8vNSpcR5LUCKBECKMkrz4ObAov0VozjQW8K8viBVPMBEATfpFdASJqAlRs0cIEtK + EhFSUg2MyeGB6eW9zYltd1kdJ/cWvJW6n6p/PYPxGZt3nfOzmQYbje9f7RZ8s0/l5tbDq2SW + XHz46Wd8ULBTWtCLhXHu8xh4Z+wL+haUsDNgnfy2d1rf7zaf7a3ZcezSbamOXXEs0V4r1S1u + /2Zk0twosrXo4YpnjxbuORPQ0v3P5k13esG/sz23Voa9VWIpzkg01GIuKk4EAI3c8+rRAgAA +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +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: Mon, 12 Aug 2013 18:41:03 -0000 + +Previously, the References header code seemed to assume +notmuch_message_get_header would return NULL if the header was not +present, but it actually returns "". As a result of this, it was +inserting an unnecessary space when concatenating an empty or missing +original references header with the new reference. + +This shows up in only one test because the text reply format later +passes the whole reply template through g_mime_filter_headers, which +has the side effect of stripping out this extra space. +--- + notmuch-reply.c | 14 ++++++++------ + test/multipart | 2 +- + 2 files changed, 9 insertions(+), 7 deletions(-) + +diff --git a/notmuch-reply.c b/notmuch-reply.c +index 3b2b58d..0f3b9cd 100644 +--- a/notmuch-reply.c ++++ b/notmuch-reply.c +@@ -537,12 +537,14 @@ create_reply_message(void *ctx, + "In-Reply-To", in_reply_to); + + orig_references = notmuch_message_get_header (message, "references"); +- references = talloc_asprintf (ctx, "%s%s%s", +- orig_references ? orig_references : "", +- orig_references ? " " : "", +- in_reply_to); +- g_mime_object_set_header (GMIME_OBJECT (reply), +- "References", references); ++ if (orig_references) { ++ references = talloc_asprintf (ctx, "%s%s%s", ++ *orig_references ? orig_references : "", ++ *orig_references ? " " : "", ++ in_reply_to); ++ g_mime_object_set_header (GMIME_OBJECT (reply), ++ "References", references); ++ } + + return reply; + } +diff --git a/test/multipart b/test/multipart +index c974226..2033023 100755 +--- a/test/multipart ++++ b/test/multipart +@@ -599,7 +599,7 @@ cat <EXPECTED + "From": "Notmuch Test Suite ", + "To": "Carl Worth , 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, +-- +1.7.10.4 +