fix: When uploading files during application dialogue, there are special whitespace characters and file name parsing errors #2738 (#2746)

This commit is contained in:
shaohuzhang1 2025-03-31 14:59:32 +08:00 committed by GitHub
parent 165c27164e
commit 36809b3314
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -392,28 +392,36 @@ const uploadFile = async (file: any, fileList: any) => {
.then((response) => {
fileList.splice(0, fileList.length)
uploadImageList.value.forEach((file: any) => {
const f = response.data.filter((f: any) => f.name === file.name)
const f = response.data.filter(
(f: any) => f.name.replaceAll(' ', '') === file.name.replaceAll(' ', '')
)
if (f.length > 0) {
file.url = f[0].url
file.file_id = f[0].file_id
}
})
uploadDocumentList.value.forEach((file: any) => {
const f = response.data.filter((f: any) => f.name === file.name)
const f = response.data.filter(
(f: any) => f.name.replaceAll(' ', '') == file.name.replaceAll(' ', '')
)
if (f.length > 0) {
file.url = f[0].url
file.file_id = f[0].file_id
}
})
uploadAudioList.value.forEach((file: any) => {
const f = response.data.filter((f: any) => f.name === file.name)
const f = response.data.filter(
(f: any) => f.name.replaceAll(' ', '') === file.name.replaceAll(' ', '')
)
if (f.length > 0) {
file.url = f[0].url
file.file_id = f[0].file_id
}
})
uploadVideoList.value.forEach((file: any) => {
const f = response.data.filter((f: any) => f.name === file.name)
const f = response.data.filter(
(f: any) => f.name.replaceAll(' ', '') === file.name.replaceAll(' ', '')
)
if (f.length > 0) {
file.url = f[0].url
file.file_id = f[0].file_id