summaryrefslogtreecommitdiffstats
path: root/routers/web/repo/issue.go
diff options
context:
space:
mode:
authorGusted <williamzijl7@hotmail.com>2022-06-04 20:10:54 +0000
committerGitHub <noreply@github.com>2022-06-04 21:10:54 +0100
commit744e45218579fe2fd130b91d9fb95ec4becd314d (patch)
treefc63d6616aaf0b1901c0c410c635f66a52f7ff42 /routers/web/repo/issue.go
parent12c742f8dc25e4148c44d1265d119c35f161bf74 (diff)
downloadgitea-744e45218579fe2fd130b91d9fb95ec4becd314d.tar.gz
gitea-744e45218579fe2fd130b91d9fb95ec4becd314d.zip
Move `/info` outside authorization (#19888)
- To use the web's API to get information about a issue/pull on a repository, doesn't require authorization(nor that the repository isn't archived). - Regressed by: #19318 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'routers/web/repo/issue.go')
-rw-r--r--routers/web/repo/issue.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index 079ccbf6cf..d418907a1f 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -1799,6 +1799,21 @@ func GetIssueInfo(ctx *context.Context) {
}
return
}
+
+ if issue.IsPull {
+ // Need to check if Pulls are enabled and we can read Pulls
+ if !ctx.Repo.Repository.CanEnablePulls() || !ctx.Repo.CanRead(unit.TypePullRequests) {
+ ctx.Error(http.StatusNotFound)
+ return
+ }
+ } else {
+ // Need to check if Issues are enabled and we can read Issues
+ if !ctx.Repo.CanRead(unit.TypeIssues) {
+ ctx.Error(http.StatusNotFound)
+ return
+ }
+ }
+
ctx.JSON(http.StatusOK, convert.ToAPIIssue(issue))
}