diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 4e711ffad2..a9617541fa 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2308,6 +2308,7 @@ release.tag_helper = Choose an existing tag or create a new tag. release.tag_helper_new = New tag. This tag will be created from the target. release.tag_helper_existing = Existing 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 5083056ebb..14ef1372c0 100644 --- a/routers/web/repo/release.go +++ b/routers/web/repo/release.go @@ -360,6 +360,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 3bd073c070..41d7dc7d2b 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 ea5c70e742..cd702d6aa6 100644 --- a/templates/repo/release/new.tmpl +++ b/templates/repo/release/new.tmpl @@ -47,7 +47,7 @@