From e2246ac02ff0fa739ff41678a16edd5448601255 Mon Sep 17 00:00:00 2001 From: Lauris BH Date: Mon, 25 Nov 2019 01:06:23 +0200 Subject: [PATCH] Fix max length check and limit in multiple repo forms (#9148) * Fix input field max length for release, label and milestone forms * Add max length for isseu and PR title --- modules/auth/repo_form.go | 8 ++++---- templates/repo/issue/labels.tmpl | 12 ++++++------ templates/repo/issue/milestone_new.tmpl | 2 +- templates/repo/issue/new_form.tmpl | 2 +- templates/repo/issue/view_title.tmpl | 2 +- templates/repo/release/new.tmpl | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go index 8d10fc1570d3d..a9985fdcbc8c8 100644 --- a/modules/auth/repo_form.go +++ b/modules/auth/repo_form.go @@ -499,9 +499,9 @@ func (f SubmitReviewForm) HasEmptyContent() bool { // NewReleaseForm form for creating release type NewReleaseForm struct { - TagName string `binding:"Required;GitRefName"` - Target string `form:"tag_target" binding:"Required"` - Title string `binding:"Required"` + TagName string `binding:"Required;GitRefName;MaxSize(255)"` + Target string `form:"tag_target" binding:"Required;MaxSize(255)"` + Title string `binding:"Required;MaxSize(255)"` Content string Draft string Prerelease bool @@ -515,7 +515,7 @@ func (f *NewReleaseForm) Validate(ctx *macaron.Context, errs binding.Errors) bin // EditReleaseForm form for changing release type EditReleaseForm struct { - Title string `form:"title" binding:"Required"` + Title string `form:"title" binding:"Required;MaxSize(255)"` Content string `form:"content"` Draft string `form:"draft"` Prerelease bool `form:"prerelease"` diff --git a/templates/repo/issue/labels.tmpl b/templates/repo/issue/labels.tmpl index 956fc955a0343..176304278fa68 100644 --- a/templates/repo/issue/labels.tmpl +++ b/templates/repo/issue/labels.tmpl @@ -17,16 +17,16 @@
- +
- +
- +
{{template "repo/issue/label_precolors"}} @@ -151,16 +151,16 @@
- +
- +
- +
{{template "repo/issue/label_precolors"}} diff --git a/templates/repo/issue/milestone_new.tmpl b/templates/repo/issue/milestone_new.tmpl index 30a7d7ebbb3d0..ea704c056145f 100644 --- a/templates/repo/issue/milestone_new.tmpl +++ b/templates/repo/issue/milestone_new.tmpl @@ -26,7 +26,7 @@
- +
diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index 99a68bc76eaa9..6777ec7c0765e 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -13,7 +13,7 @@
- + {{if .PageIsComparePull}} {{.i18n.Tr "repo.pulls.title_wip_desc" (index .PullRequestWorkInProgressPrefixes 0| Escape) | Safe}} {{end}} diff --git a/templates/repo/issue/view_title.tmpl b/templates/repo/issue/view_title.tmpl index 4b254d2c4b4a9..e97ca3265c994 100644 --- a/templates/repo/issue/view_title.tmpl +++ b/templates/repo/issue/view_title.tmpl @@ -3,7 +3,7 @@

#{{.Issue.Index}} {{.Issue.Title}}

{{if and (or .IsIssueWriter .IsIssuePoster) (not .Repository.IsArchived)}} diff --git a/templates/repo/release/new.tmpl b/templates/repo/release/new.tmpl index cdead92b9d294..01af6edc12533 100644 --- a/templates/repo/release/new.tmpl +++ b/templates/repo/release/new.tmpl @@ -19,7 +19,7 @@ {{if .PageIsEditRelease}} {{.tag_name}}@{{.tag_target}} {{else}} - + @