From e0ffd4579a4230f4f8897f1680b7168c780df54b Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Wed, 23 Oct 2024 00:01:31 +0000 Subject: [PATCH 1/2] fix --- web_src/js/features/dropzone.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web_src/js/features/dropzone.ts b/web_src/js/features/dropzone.ts index f652af045615f..15364f00aca9a 100644 --- a/web_src/js/features/dropzone.ts +++ b/web_src/js/features/dropzone.ts @@ -128,10 +128,12 @@ export async function initDropzone(dropzoneEl) { fileUuidDict = {}; for (const attachment of respData) { const file = {name: attachment.name, uuid: attachment.uuid, size: attachment.size}; - const imgSrc = `${attachmentBaseLinkUrl}/${file.uuid}`; dzInst.emit('addedfile', file); - dzInst.emit('thumbnail', file, imgSrc); dzInst.emit('complete', file); + if (isImageFile(attachment.name)) { + const imgSrc = `${attachmentBaseLinkUrl}/${file.uuid}`; + dzInst.emit('thumbnail', file, imgSrc); + } addCopyLink(file); // it is from server response, so no "type" fileUuidDict[file.uuid] = {submitted: true}; const input = createElementFromAttrs('input', {name: 'files', type: 'hidden', id: `dropzone-file-${file.uuid}`, value: file.uuid}); From cd9febc522c93f29c208aade90f86b091cded30d Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Wed, 23 Oct 2024 04:19:31 +0000 Subject: [PATCH 2/2] rename --- web_src/js/features/dropzone.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/js/features/dropzone.ts b/web_src/js/features/dropzone.ts index 15364f00aca9a..c9b0149df581c 100644 --- a/web_src/js/features/dropzone.ts +++ b/web_src/js/features/dropzone.ts @@ -130,7 +130,7 @@ export async function initDropzone(dropzoneEl) { const file = {name: attachment.name, uuid: attachment.uuid, size: attachment.size}; dzInst.emit('addedfile', file); dzInst.emit('complete', file); - if (isImageFile(attachment.name)) { + if (isImageFile(file.name)) { const imgSrc = `${attachmentBaseLinkUrl}/${file.uuid}`; dzInst.emit('thumbnail', file, imgSrc); }