1
1
mirror of https://github.com/go-gitea/gitea synced 2024-11-15 06:34:25 +00:00

Fix dropzone JS error when attachment is disabled (#31486)

Fix #31485
This commit is contained in:
wxiaoguang 2024-06-26 18:09:25 +08:00 committed by GitHub
parent 58b1ee5ebd
commit 151b786837
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -125,7 +125,9 @@ async function onEditContent(event) {
content: comboMarkdownEditor.value(), content: comboMarkdownEditor.value(),
context: editContentZone.getAttribute('data-context'), context: editContentZone.getAttribute('data-context'),
}); });
for (const fileInput of dropzoneInst?.element.querySelectorAll('.files [name=files]')) params.append('files[]', fileInput.value); for (const fileInput of dropzoneInst?.element.querySelectorAll('.files [name=files]') ?? []) {
params.append('files[]', fileInput.value);
}
const response = await POST(editContentZone.getAttribute('data-update-url'), {data: params}); const response = await POST(editContentZone.getAttribute('data-update-url'), {data: params});
const data = await response.json(); const data = await response.json();