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>
This commit is contained in:
parent
3bb028cc46
commit
9a75c2741d
4 changed files with 4 additions and 20 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue