Skip to content

Commit

Permalink
fix(main) fix path matching
Browse files Browse the repository at this point in the history
Use Node's helper to transform a file URL into a path, which works
across platforms.

Fixes: #870
  • Loading branch information
saghul committed May 26, 2023
1 parent 043272c commit 6e968b8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);

Expand Down

0 comments on commit 6e968b8

Please sign in to comment.