aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2022-01-26 20:01:35 +0000
committerGitHub <noreply@github.com>2022-01-26 20:01:35 +0000
commit9a75c2741d2806f5bb12d21b5a9d7387b2d44073 (patch)
treedddcce80b8095fa24edf683a6e61a58b0fb56835 /routers/web
parent3bb028cc46401a8a54ecab7e7c035dbb24937b6c (diff)
downloadgitea-9a75c2741d2806f5bb12d21b5a9d7387b2d44073.tar.gz
gitea-9a75c2741d2806f5bb12d21b5a9d7387b2d44073.zip
Only view milestones from current repo (#18414)
The endpoint /{username}/{reponame}/milestone/{id} is not currently restricted to the repo. This PR restricts the milestones to those within the repo. Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'routers/web')
-rw-r--r--routers/web/repo/issue.go4
-rw-r--r--routers/web/repo/milestone.go2
2 files changed, 3 insertions, 3 deletions
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index 4f2716763a..c4928054a0 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -799,7 +799,7 @@ func NewIssue(ctx *context.Context) {
milestoneID := ctx.FormInt64("milestone")
if milestoneID > 0 {
- milestone, err := models.GetMilestoneByID(milestoneID)
+ milestone, err := models.GetMilestoneByRepoID(ctx.Repo.Repository.ID, milestoneID)
if err != nil {
log.Error("GetMilestoneByID: %d: %v", milestoneID, err)
} else {
@@ -886,7 +886,7 @@ func ValidateRepoMetas(ctx *context.Context, form forms.CreateIssueForm, isPull
// Check milestone.
milestoneID := form.MilestoneID
if milestoneID > 0 {
- milestone, err := models.GetMilestoneByID(milestoneID)
+ milestone, err := models.GetMilestoneByRepoID(ctx.Repo.Repository.ID, milestoneID)
if err != nil {
ctx.ServerError("GetMilestoneByID", err)
return nil, nil, 0, 0
diff --git a/routers/web/repo/milestone.go b/routers/web/repo/milestone.go
index eadc89333f..df5fd411b4 100644
--- a/routers/web/repo/milestone.go
+++ b/routers/web/repo/milestone.go
@@ -264,7 +264,7 @@ func DeleteMilestone(ctx *context.Context) {
// MilestoneIssuesAndPulls lists all the issues and pull requests of the milestone
func MilestoneIssuesAndPulls(ctx *context.Context) {
milestoneID := ctx.ParamsInt64(":id")
- milestone, err := models.GetMilestoneByID(milestoneID)
+ milestone, err := models.GetMilestoneByRepoID(ctx.Repo.Repository.ID, milestoneID)
if err != nil {
if models.IsErrMilestoneNotExist(err) {
ctx.NotFound("GetMilestoneByID", err)