From edb1d491d968144c4b3a0d0efe0afc22448c4684 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Thu, 23 Dec 2021 19:06:13 +0100 Subject: [PATCH] * lisp/net/shr.el (shr-expand-url): Also strip trailing whitespace. --- lisp/net/shr.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 48590fd675a..4a22091d59b 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -941,9 +941,11 @@ size, and full-buffer size." shr-base)) (when (zerop (length url)) (setq url nil)) - ;; Strip leading whitespace + ;; Strip leading/trailing whitespace (and url (string-match "\\`\\s-+" url) (setq url (substring url (match-end 0)))) + (and url (string-match "\\s-+\\'" url) + (setq url (substring url 0 (match-beginning 0)))) (cond ((zerop (length url)) (nth 3 base)) ((or (not base) -- 2.39.2