From e1fcd6b7427d1e7c43ac9dcb32462a8e6d77c905 Mon Sep 17 00:00:00 2001 From: Lanre Adelowo Date: Mon, 21 Jan 2019 12:45:32 +0100 Subject: 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 --- cmd/cmd.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/cmd.go b/cmd/cmd.go index d246d2599d..5a55ac318c 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -9,10 +9,11 @@ package cmd import ( "errors" "fmt" - "strings" "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/setting" + "code.gitea.io/gitea/modules/util" + "github.com/urfave/cli" ) @@ -24,7 +25,7 @@ func argsSet(c *cli.Context, args ...string) error { return errors.New(a + " is not set") } - if len(strings.TrimSpace(c.String(a))) == 0 { + if util.IsEmptyString(a) { return errors.New(a + " is required") } } -- cgit v1.2.3