0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-02-22 15:25:05 +01:00
silverwind 648c1714fe
Fix garbled error response when issue comment creation fails
When NewComment's CreateIssueComment call failed, ctx.ServerError wrote
an HTML 500 page but the deferred function still ran and appended a JSON
redirect to the response body, producing an invalid mixed HTML+JSON
response shown as a toast error.

Fix by adding a ctx.Written() guard in the defer to skip writing when a
response was already sent. Also make post-creation errors in
CreateIssueComment (FindAndUpdateIssueMentions, GetIssueByID) non-fatal
since the comment is already persisted at that point, preventing
duplicate comments on retry.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 05:08:34 +01:00
..
2025-01-09 15:15:47 +08:00
2025-03-10 17:36:02 +08:00
2025-03-10 17:36:02 +08:00
2025-03-10 17:36:02 +08:00