aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo/issue.go
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2023-07-06 15:04:26 -0400
committerGitHub <noreply@github.com>2023-07-06 21:04:26 +0200
commit03cacf971e902e488833e35512e56a36d0861ef8 (patch)
treed38a05f2030a047daadea11411344e00864a9cf7 /routers/web/repo/issue.go
parent68e0c802f7b68aef0f9969b3530ba13c7a5a5101 (diff)
downloadgitea-03cacf971e902e488833e35512e56a36d0861ef8.tar.gz
gitea-03cacf971e902e488833e35512e56a36d0861ef8.zip
Check `ctx.Written()` for `GetActionIssue` (#25698) (#25711)
Backport #25698 by @wolfogre Fix #25697. Just avoid panic, maybe there's another bug to trigger this case. Co-authored-by: Jason Song <i@wolfogre.com>
Diffstat (limited to 'routers/web/repo/issue.go')
-rw-r--r--routers/web/repo/issue.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index 9884a5a9e8..52ccc0efa8 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -1958,7 +1958,7 @@ func GetActionIssue(ctx *context.Context) *issues_model.Issue {
return nil
}
if err = issue.LoadAttributes(ctx); err != nil {
- ctx.ServerError("LoadAttributes", nil)
+ ctx.ServerError("LoadAttributes", err)
return nil
}
return issue
@@ -3258,6 +3258,9 @@ func filterXRefComments(ctx *context.Context, issue *issues_model.Issue) error {
// GetIssueAttachments returns attachments for the issue
func GetIssueAttachments(ctx *context.Context) {
issue := GetActionIssue(ctx)
+ if ctx.Written() {
+ return
+ }
attachments := make([]*api.Attachment, len(issue.Attachments))
for i := 0; i < len(issue.Attachments); i++ {
attachments[i] = convert.ToAttachment(issue.Attachments[i])