mirror of
https://github.com/langgenius/dify.git
synced 2026-04-05 11:25:58 +08:00
fix: all upload files are disabled if upload file feature disabled (#29681)
This commit is contained in:
@@ -47,7 +47,7 @@ export const useFileSizeLimit = (fileUploadConfig?: FileUploadConfigResponse) =>
|
||||
}
|
||||
}
|
||||
|
||||
export const useFile = (fileConfig: FileUpload) => {
|
||||
export const useFile = (fileConfig: FileUpload, noNeedToCheckEnable = true) => {
|
||||
const { t } = useTranslation()
|
||||
const { notify } = useToastContext()
|
||||
const fileStore = useFileStore()
|
||||
@@ -247,7 +247,7 @@ export const useFile = (fileConfig: FileUpload) => {
|
||||
|
||||
const handleLocalFileUpload = useCallback((file: File) => {
|
||||
// Check file upload enabled
|
||||
if (!fileConfig.enabled) {
|
||||
if (!noNeedToCheckEnable && !fileConfig.enabled) {
|
||||
notify({ type: 'error', message: t('common.fileUploader.uploadDisabled') })
|
||||
return
|
||||
}
|
||||
@@ -303,7 +303,7 @@ export const useFile = (fileConfig: FileUpload) => {
|
||||
false,
|
||||
)
|
||||
reader.readAsDataURL(file)
|
||||
}, [checkSizeLimit, notify, t, handleAddFile, handleUpdateFile, params.token, fileConfig?.allowed_file_types, fileConfig?.allowed_file_extensions, fileConfig?.enabled])
|
||||
}, [noNeedToCheckEnable, checkSizeLimit, notify, t, handleAddFile, handleUpdateFile, params.token, fileConfig?.allowed_file_types, fileConfig?.allowed_file_extensions, fileConfig?.enabled])
|
||||
|
||||
const handleClipboardPasteFile = useCallback((e: ClipboardEvent<HTMLTextAreaElement>) => {
|
||||
const file = e.clipboardData?.files[0]
|
||||
|
||||
Reference in New Issue
Block a user