From 245bae1a2d6d638f0f0c782fb4b2f30bd12db2e7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 7 Sep 2023 09:24:47 +0530 Subject: [PATCH] ... --- src/calibre/srv/render_book.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/srv/render_book.py b/src/calibre/srv/render_book.py index 54acfdeff3..807312a234 100644 --- a/src/calibre/srv/render_book.py +++ b/src/calibre/srv/render_book.py @@ -395,7 +395,7 @@ def transform_html(container, name, virtualize_resources, link_uid, link_to_map, href = a.get(attr) if href: href = link_replacer(name, href) - else: + elif attr in a.attrib: a.set(attr, 'javascript:void(0)') if href and href.startswith(link_uid): a.set(attr, 'javascript:void(0)') @@ -535,7 +535,7 @@ def virtualize_html(container, name, link_uid, link_to_map, virtualized_names): elif href: a.set('target', '_blank') a.set('rel', 'noopener noreferrer') - else: + elif attr in a.attrib: a.set(attr, 'javascript:void(0)') for a in link_xpath(root):