fix: improve file list management by limiting to max files and filtering oversized files
--bug=1059967 --user=刘瑞斌 【应用】高级编排上传文件最大数量设置为100,上传101个文件,不显示上传的文件,对话时上传文件为空 https://www.tapd.cn/62980211/s/1748567
This commit is contained in:
parent
ab10ac9bc6
commit
bbf321fc96
@ -423,13 +423,14 @@ const uploadFile = async (file: any, fileList: any) => {
|
|||||||
uploadOtherList.value.length
|
uploadOtherList.value.length
|
||||||
if (file_limit_once >= maxFiles) {
|
if (file_limit_once >= maxFiles) {
|
||||||
MsgWarning(t('chat.uploadFile.limitMessage1') + maxFiles + t('chat.uploadFile.limitMessage2'))
|
MsgWarning(t('chat.uploadFile.limitMessage1') + maxFiles + t('chat.uploadFile.limitMessage2'))
|
||||||
fileList.splice(0, fileList.length)
|
fileList.splice(0, fileList.length, ...fileList.slice(0, maxFiles))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (fileList.filter((f: any) => f.size > fileLimit * 1024 * 1024).length > 0) {
|
if (fileList.filter((f: any) => f.size > fileLimit * 1024 * 1024).length > 0) {
|
||||||
// MB
|
// MB
|
||||||
MsgWarning(t('chat.uploadFile.sizeLimit') + fileLimit + 'MB')
|
MsgWarning(t('chat.uploadFile.sizeLimit') + fileLimit + 'MB')
|
||||||
fileList.splice(0, fileList.length)
|
// 只保留未超出大小限制的文件
|
||||||
|
fileList.splice(0, fileList.length, ...fileList.filter((f: any) => f.size <= fileLimit * 1024 * 1024))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const inner = reactive(file)
|
const inner = reactive(file)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user