aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/features/dropzone.ts
diff options
context:
space:
mode:
authoryp05327 <576951401@qq.com>2024-10-24 00:39:10 +0900
committerGitHub <noreply@github.com>2024-10-23 17:39:10 +0200
commit7cf611d197ba5d216ea5a05bb40137773e095f74 (patch)
treec25f8dcaa41d7c0325eeda51ad18d4cdb033bafb /web_src/js/features/dropzone.ts
parent2abdbe88b5d16dcb345d27b73f1d9738f2d826dd (diff)
downloadgitea-7cf611d197ba5d216ea5a05bb40137773e095f74.tar.gz
gitea-7cf611d197ba5d216ea5a05bb40137773e095f74.zip
Fix broken image when editing comment with non-image attachments (#32319)
Fix #32316
Diffstat (limited to 'web_src/js/features/dropzone.ts')
-rw-r--r--web_src/js/features/dropzone.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/web_src/js/features/dropzone.ts b/web_src/js/features/dropzone.ts
index f652af0456..c9b0149df5 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(file.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});