Skip to content

Commit 08cf157

Browse files
committed
fix(filePicker): catch exception when closing file picker
Signed-off-by: Jonas <jonas@freesources.org>
1 parent 06b10e9 commit 08cf157

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

src/components/Editor/MediaHandler.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,14 @@ export default {
180180
return
181181
}
182182
183-
const filePicker = buildFilePicker(this.startPath, false)
183+
let filePath
184+
try {
185+
const filePicker = buildFilePicker(this.startPath, false)
186+
filePath = await filePicker.pick()
187+
} catch {
188+
return
189+
}
184190
185-
const filePath = await filePicker.pick()
186191
if (filePath) {
187192
this.insertFromPath(filePath)
188193
}

src/composables/useLinkFile.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ export function useLinkFile({
5959
* @param startPath path to start the file picker on
6060
*/
6161
async function pickFile(startPath: string): Promise<Node | undefined> {
62-
let filePicker
62+
let file
6363
try {
64-
filePicker = buildFilePicker(startPath)
64+
const filePicker = buildFilePicker(startPath)
65+
file = await filePicker.pick()
6566
} catch {
6667
return
6768
}
68-
const file = await filePicker.pick()
6969
const client = getClient()
7070
const result = (await client.stat(`${defaultRootPath}${file}`, {
7171
details: true,

0 commit comments

Comments
 (0)