GNU bug report logs - #16285
24.3.50; [PATCH] shr: handle <a> tag with blank error.

Previous Next

Package: emacs;

Reported by: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>

Date: Sun, 29 Dec 2013 13:09:02 UTC

Severity: minor

Tags: fixed, patch

Found in version 24.3.50

Fixed in version 24.4

Done: Lars Magne 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):

From: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; [PATCH] shr: handle <a> tag with blank error.
Date: Sun, 29 Dec 2013 22:08:04 +0900
If there is <a> tag with blank, the internal link will fail.
Please reproduce the bug by following HTML.
(Internal link "section1" can not jump to internal link.)
I am not sure following patch is the best fix. Please review and
install it to the official tree if appreciated.

~~~~~~~~~~~~~~~
<html>
<head><title>INTERNAL LINK TEST</title></head>
<body>
<li><a href="#section1">section1</a></li>
<br>
  --- TEST ---
<br>
<a id="section1"></a>link test
</body>
</html>
~~~~~~~~~~~~~~~


Signed-off-by: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>

          * net/eww.el (shr-descend): Handle <a> tag with blank error.
          
---
 lisp/net/shr.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 1604ebb..20dd31f 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -380,7 +380,11 @@ size, and full-buffer size."
        (shr-generic (cdr dom)))
       (when (and shr-target-id
                 (equal (cdr (assq :id (cdr dom))) shr-target-id))
-       (put-text-property start (1+ start) 'shr-target-id shr-target-id))
+       (let ((result (ignore-errors
+                       (put-text-property start (1+ start) 'shr-target-id shr-target-id)
+                       t)))
+         (unless result
+           (put-text-property start (1- start) 'shr-target-id shr-target-id))))
       ;; If style is set, then this node has set the color.
       (when style
        (shr-colorize-region start (point)
-- 
1.8.3.1





This bug report was last modified 11 years and 140 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.