From 091d609b58cd91913effa308eb27e4a31f50a30f Mon Sep 17 00:00:00 2001 From: StyleZhang Date: Sat, 2 Nov 2024 09:37:28 +0800 Subject: [PATCH] fix: webapp upload file --- web/app/components/base/file-uploader/hooks.ts | 2 +- web/service/common.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web/app/components/base/file-uploader/hooks.ts b/web/app/components/base/file-uploader/hooks.ts index a78c414913..088160691b 100644 --- a/web/app/components/base/file-uploader/hooks.ts +++ b/web/app/components/base/file-uploader/hooks.ts @@ -216,7 +216,7 @@ export const useFile = (fileConfig: FileUpload) => { handleAddFile(uploadingFile) startProgressTimer(uploadingFile.id) - uploadRemoteFileInfo(url).then((res) => { + uploadRemoteFileInfo(url, !!params.token).then((res) => { const newFile = { ...uploadingFile, type: res.mime_type, diff --git a/web/service/common.ts b/web/service/common.ts index 4ea2d9fd27..81b96aa97c 100644 --- a/web/service/common.ts +++ b/web/service/common.ts @@ -324,8 +324,8 @@ export const verifyForgotPasswordToken: Fetcher = ({ url, body }) => post(url, { body }) -export const uploadRemoteFileInfo = (url: string) => { - return post<{ id: string; name: string; size: number; mime_type: string; url: string }>('/remote-files/upload', { body: { url } }) +export const uploadRemoteFileInfo = (url: string, isPublic?: boolean) => { + return post<{ id: string; name: string; size: number; mime_type: string; url: string }>('/remote-files/upload', { body: { url } }, { isPublicAPI: isPublic }) } export const sendEMailLoginCode = (email: string, language = 'en-US') =>