mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Disallow empty titles (#5785)
* add util method and tests * make sure the title of an issue cannot be empty * wiki title cannot be empty * pull request title cannot be empty * update to make use of the new util methof
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/notification"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
|
||||
"github.com/Unknwon/com"
|
||||
)
|
||||
@@ -875,6 +876,16 @@ func CompareAndPullRequestPost(ctx *context.Context, form auth.CreateIssueForm)
|
||||
return
|
||||
}
|
||||
|
||||
if util.IsEmptyString(form.Title) {
|
||||
PrepareCompareDiff(ctx, headUser, headRepo, headGitRepo, prInfo, baseBranch, headBranch)
|
||||
if ctx.Written() {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.RenderWithErr(ctx.Tr("repo.issues.new.title_empty"), tplComparePull, form)
|
||||
return
|
||||
}
|
||||
|
||||
patch, err := headGitRepo.GetPatch(prInfo.MergeBase, headBranch)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetPatch", err)
|
||||
|
Reference in New Issue
Block a user