Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@
"c8": "^7.11.3",
"cross-env": "^10.1.0",
"dotenv": "^16.5.0",
"electron": "^29.2.0",
"electron-builder": "^25.1.8",
"electron": "^43.4.1",
"electron-builder": "^26.15.3",
"eslint": "^8.5.0",
"eslint-plugin-jsdoc": "^43.1.1",
"eslint-plugin-simple-import-sort": "^7.0.0",
Expand Down
11 changes: 7 additions & 4 deletions src/electron/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { app, BrowserWindow, powerSaveBlocker, protocol, screen, shell } from 'electron'
import { app, BrowserWindow, net, powerSaveBlocker, protocol, screen, shell } from 'electron'
import { join } from 'path'

import { setupAutoUpdater } from './services/auto-update'
Expand Down Expand Up @@ -110,9 +110,12 @@ app.on('window-all-closed', () => {
})

app.on('ready', () => {
protocol.registerFileProtocol('file', (i, o) => {
o({ path: i.url.substring('file://'.length) })
})
// Replaces the legacy `protocol.registerFileProtocol`, which was deprecated in Electron 25
// and has limited functionality (e.g. broken Windows file-path handling) in newer versions.
// `bypassCustomProtocolHandlers` forwards to the built-in file handler; without it `net.fetch`
// would re-enter this same handler, recursing forever and leaving the renderer on a grey screen
// in packaged builds (which load index.html via `file://`).
protocol.handle('file', (request) => net.fetch(request, { bypassCustomProtocolHandlers: true }))
})

protocol.registerSchemesAsPrivileged([
Expand Down
Loading
Loading