From deec86c82bf35d79be2c1294dff8033ab355dd95 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 30 Jul 2023 20:04:03 +0530 Subject: [PATCH] E-book viewer: Allow clicking on calibre:// URLs. Fixes #2029014 [blocking navigation request to other books](https://bugs.launchpad.net/calibre/+bug/2029014) --- src/calibre/gui2/tweak_book/preview.py | 2 +- src/calibre/gui2/viewer/web_view.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/tweak_book/preview.py b/src/calibre/gui2/tweak_book/preview.py index 16c9b37cd4..805f8e0124 100644 --- a/src/calibre/gui2/tweak_book/preview.py +++ b/src/calibre/gui2/tweak_book/preview.py @@ -348,7 +348,7 @@ class WebPage(QWebEnginePage): return True if url.scheme() in (FAKE_PROTOCOL, 'data'): return True - if url.scheme() in ('http', 'https') and req_type == QWebEnginePage.NavigationType.NavigationTypeLinkClicked: + if url.scheme() in ('http', 'https', 'calibre') and req_type == QWebEnginePage.NavigationType.NavigationTypeLinkClicked: safe_open_url(url) prints('Blocking navigation request to:', url.toString()) return False diff --git a/src/calibre/gui2/viewer/web_view.py b/src/calibre/gui2/viewer/web_view.py index 00b5a253d8..e59d78dd6f 100644 --- a/src/calibre/gui2/viewer/web_view.py +++ b/src/calibre/gui2/viewer/web_view.py @@ -358,7 +358,7 @@ class WebPage(QWebEnginePage): return True if url.scheme() in (FAKE_PROTOCOL, 'data'): return True - if url.scheme() in ('http', 'https') and req_type == QWebEnginePage.NavigationType.NavigationTypeLinkClicked: + if url.scheme() in ('http', 'https', 'calibre') and req_type == QWebEnginePage.NavigationType.NavigationTypeLinkClicked: safe_open_url(url) prints('Blocking navigation request to:', url.toString()) return False