@@ -392,7 +392,17 @@ const checkMaxFilesLimit = () => {
392392 uploadOtherList .value .length
393393 )
394394}
395-
395+ const file_name_eq = (str : string , str1 : string ) => {
396+ return (
397+ str .replaceAll (' ' , ' ' ) === str1 .replaceAll (' ' , ' ' ) ||
398+ decodeHtmlEntities (str ) === decodeHtmlEntities (str1 )
399+ )
400+ }
401+ function decodeHtmlEntities(str : string ) {
402+ const tempDiv = document .createElement (' div' )
403+ tempDiv .innerHTML = str
404+ return tempDiv .textContent || tempDiv .innerText || ' '
405+ }
396406const uploadFile = async (file : any , fileList : any ) => {
397407 const { maxFiles, fileLimit } = props .applicationDetails .file_upload_setting
398408 // 单次上传文件数量限制
@@ -418,7 +428,6 @@ const uploadFile = async (file: any, fileList: any) => {
418428 formData .append (' file' , file .raw , file .name )
419429 //
420430 const extension = file .name .split (' .' ).pop ().toUpperCase () // 获取文件后缀名并转为小写
421- console .log (documentExtensions )
422431 if (imageExtensions .includes (extension )) {
423432 uploadImageList .value .push (file )
424433 } else if (documentExtensions .includes (extension )) {
@@ -452,45 +461,35 @@ console.log(documentExtensions)
452461 .then ((response ) => {
453462 fileList .splice (0 , fileList .length )
454463 uploadImageList .value .forEach ((file : any ) => {
455- const f = response .data .filter (
456- (f : any ) => f .name .replaceAll (' ' , ' ' ) === file .name .replaceAll (' ' , ' ' )
457- )
464+ const f = response .data .filter ((f : any ) => file_name_eq (f .name , file .name ))
458465 if (f .length > 0 ) {
459466 file .url = f [0 ].url
460467 file .file_id = f [0 ].file_id
461468 }
462469 })
463470 uploadDocumentList .value .forEach ((file : any ) => {
464- const f = response .data .filter (
465- (f : any ) => f .name .replaceAll (' ' , ' ' ) == file .name .replaceAll (' ' , ' ' )
466- )
471+ const f = response .data .filter ((f : any ) => file_name_eq (f .name , file .name ))
467472 if (f .length > 0 ) {
468473 file .url = f [0 ].url
469474 file .file_id = f [0 ].file_id
470475 }
471476 })
472477 uploadAudioList .value .forEach ((file : any ) => {
473- const f = response .data .filter (
474- (f : any ) => f .name .replaceAll (' ' , ' ' ) === file .name .replaceAll (' ' , ' ' )
475- )
478+ const f = response .data .filter ((f : any ) => file_name_eq (f .name , file .name ))
476479 if (f .length > 0 ) {
477480 file .url = f [0 ].url
478481 file .file_id = f [0 ].file_id
479482 }
480483 })
481484 uploadVideoList .value .forEach ((file : any ) => {
482- const f = response .data .filter (
483- (f : any ) => f .name .replaceAll (' ' , ' ' ) === file .name .replaceAll (' ' , ' ' )
484- )
485+ const f = response .data .filter ((f : any ) => file_name_eq (f .name , file .name ))
485486 if (f .length > 0 ) {
486487 file .url = f [0 ].url
487488 file .file_id = f [0 ].file_id
488489 }
489490 })
490491 uploadOtherList .value .forEach ((file : any ) => {
491- const f = response .data .filter (
492- (f : any ) => f .name .replaceAll (' ' , ' ' ) === file .name .replaceAll (' ' , ' ' )
493- )
492+ const f = response .data .filter ((f : any ) => file_name_eq (f .name , file .name ))
494493 if (f .length > 0 ) {
495494 file .url = f [0 ].url
496495 file .file_id = f [0 ].file_id
0 commit comments