fix: file from link

This commit is contained in:
StyleZhang 2024-09-24 17:47:01 +08:00
parent ceb1dde714
commit 81568752c0
2 changed files with 6 additions and 7 deletions

View File

@ -71,7 +71,11 @@ const FileInAttachmentItem = ({
<span>{ext.toLowerCase()}</span>
)
}
<span className='mx-1 system-2xs-medium'></span>
{
ext && (
<span className='mx-1 system-2xs-medium'></span>
)
}
<span>{formatFileSize(file.size || 0)}</span>
</div>
</div>

View File

@ -99,11 +99,6 @@ export const useFile = (fileConfig: FileUpload) => {
const allowedFileTypes = fileConfig.allowed_file_types
const fileName = getFileNameFromUrl(url)
if (!isAllowedFileExtension(fileName, fileConfig.allowed_file_types || [], fileConfig.allowed_file_extensions || [])) {
notify({ type: 'error', message: t('common.fileUploader.fileExtensionNotSupport') })
return
}
const uploadingFile = {
id: uuid4(),
name: fileName,
@ -128,7 +123,7 @@ export const useFile = (fileConfig: FileUpload) => {
notify({ type: 'error', message: t('common.fileUploader.pasteFileLinkInvalid') })
handleRemoveFile(uploadingFile.id)
})
}, [handleAddFile, handleUpdateFile, notify, t, handleRemoveFile, fileConfig?.allowed_file_types, fileConfig?.allowed_file_extensions])
}, [handleAddFile, handleUpdateFile, notify, t, handleRemoveFile, fileConfig?.allowed_file_types])
const handleLoadFileFromLinkSuccess = useCallback(() => { }, [])