From cb477f32d7164ba6f0e40f293d51ed695e0c0a96 Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Fri, 18 Nov 2022 16:04:11 +0100 Subject: [PATCH 1/2] Fix "Open in new window" context menu action in release builds --- src/main/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/index.js b/src/main/index.js index b7b792c980b9..ec883f01dc46 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -31,7 +31,7 @@ function runApp() { }, { label: 'Open in a New Window', - visible: parameters.linkURL.includes((new URL(browserWindow.webContents.getURL())).origin), + visible: parameters.linkURL.startsWith(browserWindow.webContents.getURL()), click: () => { createWindow({ replaceMainWindow: false, windowStartupUrl: parameters.linkURL, showWindowNow: true }) } From 31fd040014cf6dacc22adf917831aa9b55fbc2e6 Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Sat, 19 Nov 2022 12:53:22 +0100 Subject: [PATCH 2/2] Better check and add comment --- src/main/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/index.js b/src/main/index.js index ec883f01dc46..b1d724c25c08 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -31,7 +31,8 @@ function runApp() { }, { label: 'Open in a New Window', - visible: parameters.linkURL.startsWith(browserWindow.webContents.getURL()), + // Only show the option for in-app URLs and not external ones + visible: parameters.linkURL.split('#')[0] === browserWindow.webContents.getURL().split('#')[0], click: () => { createWindow({ replaceMainWindow: false, windowStartupUrl: parameters.linkURL, showWindowNow: true }) }