From: "Łukasz Stelmach" <steelman@post.pl>
To: 45355@debbugs.gnu.org
Subject: bug#45355: 26.1; shr-tag-base doesn't handle <base href=""> properly
Date: Mon, 21 Dec 2020 21:35:57 +0100 [thread overview]
Message-ID: <87zh26ucb6.fsf%steelman@post.pl> (raw)
[-- Attachment #1: Type: text/plain, Size: 538 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Handle-gracefully-href-in-base-tags.patch --]
[-- Type: text/x-diff, Size: 932 bytes --]
From f92e8b8ab5b6f0970611c91cf80e418712ed2b58 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Stelmach?= <stlman@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
next reply other threads:[~2020-12-21 20:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-21 20:35 Łukasz Stelmach [this message]
2020-12-22 6:47 ` bug#45355: 26.1; shr-tag-base doesn't handle <base href=""> properly Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zh26ucb6.fsf%steelman@post.pl \
--to=steelman@post.pl \
--cc=45355@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).