From aa19c762353f2a65a92106346e285f68820d1ea5 Mon Sep 17 00:00:00 2001 From: frostime Date: Mon, 22 May 2023 21:33:58 +0800 Subject: [PATCH] fix getFile with err --- src/api.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/api.ts b/src/api.ts index 0fcd147..0fa2013 100644 --- a/src/api.ts +++ b/src/api.ts @@ -308,8 +308,12 @@ export async function getFile(path: string): Promise { path: path } let url = '/api/file/getFile'; - let file = await fetchSyncPost(url, data); - return file; + try { + let file = await fetchSyncPost(url, data); + return file; + } catch (error_msg) { + return null; + } } export async function putFile(path: string, isDir: boolean, file: any) {