1
1
mirror of https://github.com/go-gitea/gitea synced 2024-11-01 07:44:25 +00:00

Fix broken image when editing comment with non-image attachments (#32319)

Fix #32316
This commit is contained in:
yp05327 2024-10-24 00:39:10 +09:00 committed by GitHub
parent 2abdbe88b5
commit 7cf611d197
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -128,10 +128,12 @@ export async function initDropzone(dropzoneEl) {
fileUuidDict = {}; fileUuidDict = {};
for (const attachment of respData) { for (const attachment of respData) {
const file = {name: attachment.name, uuid: attachment.uuid, size: attachment.size}; const file = {name: attachment.name, uuid: attachment.uuid, size: attachment.size};
const imgSrc = `${attachmentBaseLinkUrl}/${file.uuid}`;
dzInst.emit('addedfile', file); dzInst.emit('addedfile', file);
dzInst.emit('thumbnail', file, imgSrc);
dzInst.emit('complete', file); 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" addCopyLink(file); // it is from server response, so no "type"
fileUuidDict[file.uuid] = {submitted: true}; fileUuidDict[file.uuid] = {submitted: true};
const input = createElementFromAttrs('input', {name: 'files', type: 'hidden', id: `dropzone-file-${file.uuid}`, value: file.uuid}); const input = createElementFromAttrs('input', {name: 'files', type: 'hidden', id: `dropzone-file-${file.uuid}`, value: file.uuid});