]> source.dussan.org Git - gitea.git/commitdiff
Fix dropzone JS error when attachment is disabled (#31486)
authorwxiaoguang <wxiaoguang@gmail.com>
Wed, 26 Jun 2024 10:09:25 +0000 (18:09 +0800)
committerGitHub <noreply@github.com>
Wed, 26 Jun 2024 10:09:25 +0000 (18:09 +0800)
Fix #31485

web_src/js/features/repo-issue-edit.js

index e633b42fdf82a9f13bf2cd2bbc54cd876f45a703..919daa9c503d9b20b9da86eead0a35ad999d900f 100644 (file)
@@ -125,7 +125,9 @@ async function onEditContent(event) {
         content: comboMarkdownEditor.value(),
         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 data = await response.json();