From 6e968b87969d5e2a5317951dbb3c6b202f8e0fff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Fri, 26 May 2023 14:11:38 +0200 Subject: fix(main) fix path matching Use Node's helper to transform a file URL into a path, which works across platforms. Fixes: https://github.com/jitsi/jitsi-meet-electron/issues/870 --- main.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/main.js b/main.js index 877383a..0bc659c 100644 --- a/main.js +++ b/main.js @@ -245,11 +245,10 @@ function createJitsiMeetWindow() { }; mainWindow.webContents.session.webRequest.onBeforeSendHeaders(fileFilter, (details, callback) => { - const requestedUrl = new URL.URL(details.url); - const requestedBasename = path.resolve(decodeURIComponent(requestedUrl.pathname)); + const requestedPath = path.resolve(URL.fileURLToPath(details.url)); const appBasePath = path.resolve(basePath); - if (!requestedBasename.startsWith(appBasePath)) { + if (!requestedPath.startsWith(appBasePath)) { callback({ cancel: true }); console.warn(`Rejected file URL: ${details.url}`); -- cgit v1.2.3