aboutsummaryrefslogtreecommitdiffstats
path: root/models/issue_milestone.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-01-27 17:23:21 +0100
committerzeripath <art27@cantab.net>2020-01-27 16:23:21 +0000
commit88c3ccb8971c387f4e283a54eacb59e91ef9f87b (patch)
tree90544aed60b9d5a8f90c089f56caacf3063d8aa9 /models/issue_milestone.go
parent51f6a7ab1022342d8e552ffa9925118d8c692a96 (diff)
downloadgitea-88c3ccb8971c387f4e283a54eacb59e91ef9f87b.tar.gz
gitea-88c3ccb8971c387f4e283a54eacb59e91ef9f87b.zip
trim whitespace of MilestoneName at creation/rename (#10017)
Diffstat (limited to 'models/issue_milestone.go')
-rw-r--r--models/issue_milestone.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/models/issue_milestone.go b/models/issue_milestone.go
index 68a568b51a..198fa7d78c 100644
--- a/models/issue_milestone.go
+++ b/models/issue_milestone.go
@@ -6,6 +6,7 @@ package models
import (
"fmt"
+ "strings"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
@@ -95,6 +96,8 @@ func NewMilestone(m *Milestone) (err error) {
return err
}
+ m.Name = strings.TrimSpace(m.Name)
+
if _, err = sess.Insert(m); err != nil {
return err
}
@@ -272,6 +275,7 @@ func GetMilestones(repoID int64, page int, isClosed bool, sortType string) (Mile
}
func updateMilestone(e Engine, m *Milestone) error {
+ m.Name = strings.TrimSpace(m.Name)
_, err := e.ID(m.ID).AllCols().
SetExpr("num_issues", builder.Select("count(*)").From("issue").Where(
builder.Eq{"milestone_id": m.ID},