aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1
diff options
context:
space:
mode:
authorJason Song <i@wolfogre.com>2022-11-12 08:32:04 +0800
committerGitHub <noreply@github.com>2022-11-12 08:32:04 +0800
commitbf2078640f98094ae63cb53f6a71964b315a34ce (patch)
treefacc0c60d45b6ccd52934f386c83ca7da194a2d0 /routers/api/v1
parent9f8e7789187013ab6752c2635b24c9dd1d70cd90 (diff)
downloadgitea-bf2078640f98094ae63cb53f6a71964b315a34ce.tar.gz
gitea-bf2078640f98094ae63cb53f6a71964b315a34ce.zip
Load GitRepo in API before deleting issue (#21720)
Fix #20921. The `ctx.Repo.GitRepo` has been used in deleting issues when the issue is a PR. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'routers/api/v1')
-rw-r--r--routers/api/v1/api.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go
index 4b27270840..ee1804daa7 100644
--- a/routers/api/v1/api.go
+++ b/routers/api/v1/api.go
@@ -898,7 +898,7 @@ func Routes(ctx gocontext.Context) *web.Route {
m.Group("/{index}", func() {
m.Combo("").Get(repo.GetIssue).
Patch(reqToken(), bind(api.EditIssueOption{}), repo.EditIssue).
- Delete(reqToken(), reqAdmin(), repo.DeleteIssue)
+ Delete(reqToken(), reqAdmin(), context.ReferencesGitRepo(), repo.DeleteIssue)
m.Group("/comments", func() {
m.Combo("").Get(repo.ListIssueComments).
Post(reqToken(), mustNotBeArchived, bind(api.CreateIssueCommentOption{}), repo.CreateIssueComment)