diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 081ffb7abf..5154aadb68 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2288,6 +2288,7 @@ release.tag_name = Tag name release.target = Target release.tag_helper = Choose an existing tag or create a new tag. release.title = Title +release.title_empty = Title cannot be empty. release.content = Content release.prerelease_desc = Mark as Pre-Release release.prerelease_helper = Mark this release unsuitable for production use. diff --git a/routers/web/repo/release.go b/routers/web/repo/release.go index e969fdc5ab..63c8797fe5 100644 --- a/routers/web/repo/release.go +++ b/routers/web/repo/release.go @@ -357,6 +357,12 @@ func NewReleasePost(ctx *context.Context) { return } + // Title of release cannot be empty + if len(form.TagOnly) == 0 && len(form.Title) == 0 { + ctx.RenderWithErr(ctx.Tr("repo.release.title_empty"), tplReleaseNew, &form) + return + } + var attachmentUUIDs []string if setting.Attachment.Enabled { attachmentUUIDs = form.Files diff --git a/services/forms/repo_form.go b/services/forms/repo_form.go index e9645b5ab7..a08f9bc9e4 100644 --- a/services/forms/repo_form.go +++ b/services/forms/repo_form.go @@ -693,7 +693,7 @@ type UpdateAllowEditsForm struct { type NewReleaseForm struct { TagName string `binding:"Required;GitRefName;MaxSize(255)"` Target string `form:"tag_target" binding:"Required;MaxSize(255)"` - Title string `binding:"Required;MaxSize(255)"` + Title string `binding:"MaxSize(255)"` Content string Draft string TagOnly string diff --git a/templates/repo/release/new.tmpl b/templates/repo/release/new.tmpl index 37d7ca0321..0cac670522 100644 --- a/templates/repo/release/new.tmpl +++ b/templates/repo/release/new.tmpl @@ -42,7 +42,7 @@