aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlen Lowland <glenlowland@proton.me>2023-05-25 18:12:59 +0100
committerGlen Lowland <glenlowland@proton.me>2023-05-25 18:12:59 +0100
commita659c520f00395e81d3aaae3a637126aa2a16a00 (patch)
treeae4c4843bb353d4a451ce0aaf3117fd2b381b270
parentForgot to re-generate html, it made a problem (diff)
downloadlibredirect-a659c520f00395e81d3aaae3a637126aa2a16a00.zip
Fix "Search LibRedirect" from context menu
When you try to select a text on a page and click a "Search LibRedirect" on Google Chrome - it does not redirect to the frontend and shows error page. After an investigation and debug, I saw Chrome passes details.initiator = "null" for such requests. Handle this case in code and allow redirects.
-rw-r--r--src/pages/background/background.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pages/background/background.js b/src/pages/background/background.js
index 3b3dd54a..7652d726 100644
--- a/src/pages/background/background.js
+++ b/src/pages/background/background.js
@@ -36,7 +36,7 @@ browser.webRequest.onBeforeRequest.addListener(
let initiator
try {
if (details.originUrl) initiator = new URL(details.originUrl)
- else if (details.initiator) initiator = new URL(details.initiator)
+ else if (details.initiator && details.initiator !== "null") initiator = new URL(details.initiator)
} catch {
return null
}