From c170862de7d92cca1cc54d8ef89c93b9ccad9769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=86=E8=90=8C=E9=97=B7=E6=B2=B9=E7=93=B6?= <253605712@qq.com> Date: Sat, 16 Nov 2024 22:37:25 +0800 Subject: [PATCH] fix:custom file extension not support (#10759) Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com> --- web/app/components/base/file-uploader/utils.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/web/app/components/base/file-uploader/utils.ts b/web/app/components/base/file-uploader/utils.ts index eb9199d74b..9c71724fb2 100644 --- a/web/app/components/base/file-uploader/utils.ts +++ b/web/app/components/base/file-uploader/utils.ts @@ -44,12 +44,6 @@ export const fileUpload: FileUpload = ({ } export const getFileExtension = (fileName: string, fileMimetype: string, isRemote?: boolean) => { - if (fileMimetype) - return mime.getExtension(fileMimetype) || '' - - if (isRemote) - return '' - if (fileName) { const fileNamePair = fileName.split('.') const fileNamePairLength = fileNamePair.length @@ -58,6 +52,12 @@ export const getFileExtension = (fileName: string, fileMimetype: string, isRemot return fileNamePair[fileNamePairLength - 1] } + if (fileMimetype) + return mime.getExtension(fileMimetype) || '' + + if (isRemote) + return '' + return '' }