[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#57796: 29.0.50; textsec-link-suspicious-p is unaware of eww-url-tran
From: |
Visuwesh |
Subject: |
bug#57796: 29.0.50; textsec-link-suspicious-p is unaware of eww-url-transformers |
Date: |
Wed, 14 Sep 2022 19:18:51 +0530 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
[புதன் செப்டம்பர் 14, 2022] Visuwesh wrote:
> Upon digging this issue further, I see the problem is with shr-tag-a,
> not textsec-link-suspicious-p. Sorry for the misleading bug title---I'm
> not sure what the right way to rename the title is.
Looks like eww uses a custom tag function for <a></a>. I tried the
following patch but I cannot figure out how to turn `href' into a full
URL.
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 6ed0719eca..de4a06dc47 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -781,9 +781,13 @@ eww-tag-link
(defun eww-tag-a (dom)
(eww-handle-link dom)
- (let ((start (point)))
+ (let ((start (point))
+ (href (dom-attr dom 'href)))
+ (when href
+ (setq href (eww--transform-url (shr-expand-url href)))
+ (dom-set-attribute dom 'href href))
(shr-tag-a dom)
- (if (dom-attr dom 'href)
+ (if href
(put-text-property start (point)
'keymap
(if (mm-images-in-region-p start (point))