]> git.eshelyaron.com Git - emacs.git/commitdiff
Handle gracefully href="" in base tags in shr
authorŁukasz Stelmach <stlman@poczta.fm>
Tue, 22 Dec 2020 06:47:23 +0000 (07:47 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 23 Dec 2020 05:26:06 +0000 (06:26 +0100)
* net/shr.el (shr-tag-base): shr-parse-base can't handle empty
strings gracefully.  Don't call it unless href is a non-empty
string (bug#45355).

lisp/net/shr.el

index 2e5dd5ffa50c2ab765d59d7119941b36dc643380..1648e56cfb4ae1b36e623d48400c01c2304dd30a 100644 (file)
@@ -1516,8 +1516,9 @@ ones, in case fg and bg are nil."
       plist)))
 
 (defun shr-tag-base (dom)
-  (when-let* ((base (dom-attr dom 'href)))
-    (setq shr-base (shr-parse-base base)))
+  (let ((base (dom-attr dom 'href)))
+    (when (> (length base) 0)
+      (setq shr-base (shr-parse-base base))))
   (shr-generic dom))
 
 (defun shr-tag-a (dom)