From 7e7974154b902f53dd1646ec0246b9e8b7c32824 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 20 Jan 2022 07:45:33 +0100 Subject: [PATCH] Improve textsec-domain-suspicious-p message * lisp/international/textsec.el (textsec-domain-suspicious-p): Ensure that we're not confusing the user if there's a directional override in the string we're checking. --- lisp/international/textsec.el | 7 +++++-- test/lisp/international/textsec-tests.el | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lisp/international/textsec.el b/lisp/international/textsec.el index bf90afb7c00..6b37e925698 100644 --- a/lisp/international/textsec.el +++ b/lisp/international/textsec.el @@ -244,8 +244,11 @@ or use certain other unusual mixtures of characters." (seq-do (lambda (char) (when (eq (elt idna-mapping-table char) t) - (throw 'found (format "Disallowed character: `%s' (#x%x)" - (string char) char)))) + (throw 'found + (format "Disallowed character: `%s' (#x%x, %s)" + (bidi-string-strip-control-characters (string char)) + char + (get-char-code-property char 'name))))) domain) ;; Does IDNA allow it? (unless (puny-highly-restrictive-domain-p domain) diff --git a/test/lisp/international/textsec-tests.el b/test/lisp/international/textsec-tests.el index acd77971501..f8fc0564807 100644 --- a/test/lisp/international/textsec-tests.el +++ b/test/lisp/international/textsec-tests.el @@ -162,6 +162,10 @@ (textsec-email-address-header-suspicious-p "Lars Ingebrigtsen ")) + (should + (textsec-email-address-header-suspicious-p + "Lars Ingebrigtsen ")) + (should (textsec-email-address-header-suspicious-p "דגבא "))) -- 2.39.5