]> source.dussan.org Git - gitea.git/commitdiff
Fix: Abnormal strings appear when comments are saved after editing (#29991)
authorHEREYUA <37935145+HEREYUA@users.noreply.github.com>
Fri, 22 Mar 2024 11:22:36 +0000 (19:22 +0800)
committerGitHub <noreply@github.com>
Fri, 22 Mar 2024 11:22:36 +0000 (11:22 +0000)
Partially resolved(The second problem):
[#29986](https://github.com/go-gitea/gitea/issues/29986)

**Before**
HTML strings appear when comments are saved after editing

![image](https://github.com/go-gitea/gitea/assets/37935145/c356d99a-8473-4cc5-8e38-1b207ccd8b12)

**After**

https://github.com/go-gitea/gitea/assets/37935145/525601f9-3ee1-4266-9105-36d82b91b1c8

web_src/js/features/repo-legacy.js

index 5afb407223b0f16d521249116c0a494e24fc45a7..18978e9e29edd15d7518f23e3c1648fea0e9e58e 100644 (file)
@@ -436,7 +436,7 @@ async function onEditContent(event) {
       const $content = $segment;
       if (!$content.find('.dropzone-attachments').length) {
         if (data.attachments !== '') {
-          $content[0].append(data.attachments);
+          $content[0].insertAdjacentHTML('beforeend', data.attachments);
         }
       } else if (data.attachments === '') {
         $content.find('.dropzone-attachments').remove();