mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Backport #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:
		@@ -134,22 +134,6 @@ func GetMilestoneByRepoIDANDName(repoID int64, name string) (*Milestone, error)
 | 
			
		||||
	return &mile, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetMilestoneByID returns the milestone via id .
 | 
			
		||||
func GetMilestoneByID(id int64) (*Milestone, error) {
 | 
			
		||||
	return getMilestoneByID(db.GetEngine(db.DefaultContext), id)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getMilestoneByID(e db.Engine, id int64) (*Milestone, error) {
 | 
			
		||||
	var m Milestone
 | 
			
		||||
	has, err := e.ID(id).Get(&m)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	} else if !has {
 | 
			
		||||
		return nil, ErrMilestoneNotExist{ID: id, RepoID: 0}
 | 
			
		||||
	}
 | 
			
		||||
	return &m, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UpdateMilestone updates information of given milestone.
 | 
			
		||||
func UpdateMilestone(m *Milestone, oldIsClosed bool) error {
 | 
			
		||||
	ctx, committer, err := db.TxContext()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user