Skip to content

Commit

Permalink
Fix broken image when editing comment with non-image attachments (#32319
Browse files Browse the repository at this point in the history
)

Fix #32316
  • Loading branch information
yp05327 authored Oct 23, 2024
1 parent 2abdbe8 commit 7cf611d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions web_src/js/features/dropzone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down

0 comments on commit 7cf611d

Please sign in to comment.