emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 5a64286d6a: Make textsec-link-suspicious-p have fewer false posit


From: Lars Ingebrigtsen
Subject: master 5a64286d6a: Make textsec-link-suspicious-p have fewer false positives
Date: Thu, 20 Jan 2022 06:37:44 -0500 (EST)

branch: master
commit 5a64286d6a3ceaa5ca114ba5987f6698189647f5
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make textsec-link-suspicious-p have fewer false positives
    
    * lisp/international/textsec.el (textsec-link-suspicious-p):
    Attempt to improve the domain-guessing logic.
---
 lisp/international/textsec.el | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/lisp/international/textsec.el b/lisp/international/textsec.el
index ba39c44e85..db13839e90 100644
--- a/lisp/international/textsec.el
+++ b/lisp/international/textsec.el
@@ -398,13 +398,14 @@ when the link text looks like an URL itself, but doesn't 
lead to
 the same domain as the URL."
   (let* ((url (car link))
          (text (string-trim (cdr link)))
-         (text-bits (seq-filter
-                     (lambda (bit)
-                       (and (string-match-p "\\`[^.]+\\.[^.]+.*\\'" bit)
-                            ;; All-numerical texts are probably not
-                            ;; suspicious (but what about IP addresses?).
-                            (not (string-match-p "\\`[0-9.]+\\'" bit))))
-                     (split-string text))))
+         (text-bits
+          (seq-filter
+           (lambda (bit)
+             (and (string-match-p "\\`[^.[:punct:]]+\\.[^.[:punct:]]+\\'" bit)
+                  ;; All-numerical texts are probably not
+                  ;; suspicious (but what about IP addresses?).
+                  (not (string-match-p "\\`[0-9.]+\\'" bit))))
+           (split-string text))))
     (when text-bits
       (setq text-bits (seq-map (lambda (string)
                                  (if (not (string-match-p "\\`[^:]+:" string))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]