Skip to content

Commit 7cf611d

Browse files
authored
Fix broken image when editing comment with non-image attachments (#32319)
Fix #32316
1 parent 2abdbe8 commit 7cf611d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

web_src/js/features/dropzone.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,12 @@ export async function initDropzone(dropzoneEl) {
128128
fileUuidDict = {};
129129
for (const attachment of respData) {
130130
const file = {name: attachment.name, uuid: attachment.uuid, size: attachment.size};
131-
const imgSrc = `${attachmentBaseLinkUrl}/${file.uuid}`;
132131
dzInst.emit('addedfile', file);
133-
dzInst.emit('thumbnail', file, imgSrc);
134132
dzInst.emit('complete', file);
133+
if (isImageFile(file.name)) {
134+
const imgSrc = `${attachmentBaseLinkUrl}/${file.uuid}`;
135+
dzInst.emit('thumbnail', file, imgSrc);
136+
}
135137
addCopyLink(file); // it is from server response, so no "type"
136138
fileUuidDict[file.uuid] = {submitted: true};
137139
const input = createElementFromAttrs('input', {name: 'files', type: 'hidden', id: `dropzone-file-${file.uuid}`, value: file.uuid});

0 commit comments

Comments
 (0)