From e84d66be4a8ac05de3278f0d974059b7373c314d Mon Sep 17 00:00:00 2001 From: brian91292 <8050523+brian91292@users.noreply.github.com> Date: Thu, 29 Jun 2023 11:45:38 -0500 Subject: [PATCH] file redirect fix --- electron/app.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/electron/app.ts b/electron/app.ts index a6a76fa..75dd7ac 100644 --- a/electron/app.ts +++ b/electron/app.ts @@ -602,6 +602,14 @@ function setupApp() { mainWindow.focus(); } }); + app.on('web-contents-created', (e, webContents) => { + webContents.on('will-redirect', (e, url) => { + if (/^file:/.test(url)) { + console.warn('Prevented redirect to ' + url); + e.preventDefault(); + } + }); + }); app.on('certificate-error', (event, webContents, url, error, certificate, callback) => { if (process.env.NODE_ENV === 'dev') { // Verification logic.