Skip to content

Commit a49b2ce

Browse files
author
duncan
committed
fix ERR_UNKNOWN_URL_SCHEME by intercepting file:// protocol
fix whitespace Revert "fix whitespace" This reverts commit 608e364ebbabb19ffd6c3e3e0f357251c2e8e348. fix whitespace
1 parent 3dea167 commit a49b2ce

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ElectronNET.Host/main.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const { app } = require('electron');
22
const { BrowserWindow } = require('electron');
3+
const { protocol } = require('electron');
34
const path = require('path');
45
const cProcess = require('child_process').spawn;
56
const portscanner = require('portscanner');
@@ -51,6 +52,14 @@ if (manifestJsonFile.singleInstance || manifestJsonFile.aspCoreBackendPort) {
5152
}
5253

5354
app.on('ready', () => {
55+
56+
// Fix ERR_UNKNOWN_URL_SCHEME using file protocol
57+
// https://github.com/electron/electron/issues/23757
58+
protocol.registerFileProtocol('file', (request, callback) => {
59+
const pathname = request.url.replace('file:///', '');
60+
callback(pathname);
61+
});
62+
5463
if (isSplashScreenEnabled()) {
5564
startSplashScreen();
5665
}
@@ -273,4 +282,4 @@ function getEnvironmentParameter() {
273282
}
274283

275284
return '';
276-
}
285+
}

0 commit comments

Comments
 (0)