-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(app): fix file uploading on the desktop app
- Loading branch information
Showing
6 changed files
with
61 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
// preload script for renderer process | ||
// defines subset of Electron API that renderer process is allowed to access | ||
// for security reasons | ||
import { ipcRenderer } from 'electron' | ||
import { ipcRenderer, webUtils } from 'electron' | ||
|
||
// The renderer process is not permitted the file path for any type "file" input | ||
// post Electron v32. The correct way of doing this involves the context bridge, | ||
// see comments in Electron settings. | ||
// See https://www.electronjs.org/docs/latest/breaking-changes#removed-filepath | ||
const getFilePathFrom = (file: File): Promise<string> => { | ||
return Promise.resolve(webUtils.getPathForFile(file)) | ||
} | ||
|
||
// @ts-expect-error can't get TS to recognize global.d.ts | ||
global.APP_SHELL_REMOTE = { ipcRenderer } | ||
global.APP_SHELL_REMOTE = { ipcRenderer, getFilePathFrom } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters