Skip to content

Commit a8cdea0

Browse files
author
Gusted
authored
Fix remove file on initial comment (#20127)
Store the file uuid(which is returned by Gitea in the upload file response) onto the file object, so it can be used for the remove feature to specify this file. Fix #20115
1 parent 2111741 commit a8cdea0

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Diff for: web_src/js/features/common-global.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ export function initGlobalDropzone() {
192192
thumbnailWidth: 480,
193193
thumbnailHeight: 480,
194194
init() {
195-
this.on('success', (_file, data) => {
195+
this.on('success', (file, data) => {
196+
file.uuid = data.uuid;
196197
const input = $(`<input id="${data.uuid}" name="files" type="hidden">`).val(data.uuid);
197198
$dropzone.find('.files').append(input);
198199
});

Diff for: web_src/js/features/repo-legacy.js

+1
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ async function onEditContent(event) {
300300
thumbnailHeight: 480,
301301
init() {
302302
this.on('success', (file, data) => {
303+
file.uuid = data.uuid;
303304
fileUuidDict[file.uuid] = {submitted: false};
304305
const input = $(`<input id="${data.uuid}" name="files" type="hidden">`).val(data.uuid);
305306
$dropzone.find('.files').append(input);

0 commit comments

Comments
 (0)