emacs: reply subject sanitization

classic Classic list List threaded Threaded
5 messages Options
Jani Nikula Jani Nikula
Reply | Threaded
Open this post in threaded view
|

emacs: reply subject sanitization

v2 of id:[hidden email], now with test.

BR,
Jani.

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Jani Nikula Jani Nikula
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/2] test: add emacs reply test for subjects with TAB

Expect TABs to be sanitized from the subject line. Known broken.
---
 test/T310-emacs.sh | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index fde11790a600..2ef566bac490 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -401,6 +401,29 @@ Notmuch Test Suite <[hidden email]> writes:
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "Reply within emacs to a message with TAB in subject"
+test_subtest_known_broken
+test_emacs '(let ((message-hidden-headers ''()))
+    (notmuch-search "id:[hidden email]")
+    (notmuch-test-wait)
+    (notmuch-search-show-thread)
+    (notmuch-test-wait)
+    (notmuch-show-reply-sender)
+    (test-output))'
+sed -i -e 's/^In-Reply-To: <.*>$/In-Reply-To: <XXX>/' OUTPUT
+sed -i -e 's/^References: <.*>$/References: <XXX>/' OUTPUT
+sed -i -e '/^--text follows this line--$/q' OUTPUT
+cat <<EOF >EXPECTED
+From: Notmuch Test Suite <[hidden email]>
+To: Mikhail Gusarov <[hidden email]>
+Subject: Re: [notmuch] [PATCH 1/2] Close message file after parsing message headers
+In-Reply-To: <XXX>
+Fcc: ${MAIL_DIR}/sent
+References: <XXX>
+--text follows this line--
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_begin_subtest "Reply from alternate address within emacs"
 add_message '[from]="Sender <[hidden email]>"' \
      [to]=[hidden email]
--
2.11.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Jani Nikula Jani Nikula
Reply | Threaded
Open this post in threaded view
|

[PATCH 2/2] emacs: sanitize subject in replies

In reply to this post by Jani Nikula
Commit a7964c86d125 ("emacs: Sanitize authors and subjects in search
and show") added sanitization of header information for display. Do
the same for reply subjects.

This fixes the long-standing annoying artefact of certain versions of
mailman using tab as folding whitespace, leading to tabs in reply
subjects.
---
 emacs/notmuch-mua.el | 2 +-
 test/T310-emacs.sh   | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index fd64b362b542..7a341ebf0588 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -218,7 +218,7 @@ mutiple parts get a header."
      else
      collect pair)))
   (notmuch-mua-mail (plist-get reply-headers :To)
-    (plist-get reply-headers :Subject)
+    (notmuch-sanitize (plist-get reply-headers :Subject))
     (notmuch-headers-plist-to-alist reply-headers)
     nil (notmuch-mua-get-switch-function))))
 
diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index 2ef566bac490..4456bc659158 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -402,7 +402,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "Reply within emacs to a message with TAB in subject"
-test_subtest_known_broken
 test_emacs '(let ((message-hidden-headers ''()))
     (notmuch-search "id:[hidden email]")
     (notmuch-test-wait)
--
2.11.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Edmondson David Edmondson
Reply | Threaded
Open this post in threaded view
|

Re: emacs: reply subject sanitization

In reply to this post by Jani Nikula
On Tuesday, 2017-09-26 at 21:26:06 +0300, Jani Nikula wrote:

> v2 of id:[hidden email], now with test.

Looks good.

dme.
--
I can't explain, you would not understand. This is not how I am.
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

Re: emacs: reply subject sanitization

In reply to this post by Jani Nikula
Jani Nikula <[hidden email]> writes:

> v2 of id:[hidden email], now with test.
>
> BR,
> Jani.

pushed.

d
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch