GNU bug report logs -
#45355
26.1; shr-tag-base doesn't handle <base href=""> properly
Previous Next
Reported by: Łukasz Stelmach <steelman <at> post.pl>
Date: Mon, 21 Dec 2020 20:37:02 UTC
Severity: normal
Tags: fixed
Found in version 26.1
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
For what it's worth, W3C HTML Validator claims that a document with an
empty string in the href attribute of a base tag
<base href="">
is valid. I found such document recently in my INBOX and Gnus was unable
to display it correctly because the second string-match in
shr-parse-base breaks when local is nil. My solution is not to call
shr-parse-base not only when href is not present but also when href is
an empty string.
The patch has been crated on the current master branch.
--
Kind regards,
Łukasz Stelmach
[0001-Handle-gracefully-href-in-base-tags.patch (text/x-diff, inline)]
From f92e8b8ab5b6f0970611c91cf80e418712ed2b58 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Stelmach?= <stlman <at> poczta.fm>
Date: Mon, 21 Dec 2020 21:07:28 +0100
Subject: [PATCH] Handle gracefully href="" in base tags
* 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.
---
lisp/net/shr.el | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 2e5dd5ffa5..150ad88d4c 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -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)
--
2.20.1
This bug report was last modified 4 years and 149 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.