diff options
author | Lanre Adelowo <adelowomailbox@gmail.com> | 2019-01-21 12:45:32 +0100 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2019-01-21 13:45:32 +0200 |
commit | e1fcd6b7427d1e7c43ac9dcb32462a8e6d77c905 (patch) | |
tree | 46b617eb487061dcb8bfd3da7175d7bd23f51e6d /cmd/cmd.go | |
parent | 8a92544a3e06e0c1146ee6d0c340d662e1b0633c (diff) | |
download | gitea-e1fcd6b7427d1e7c43ac9dcb32462a8e6d77c905.tar.gz gitea-e1fcd6b7427d1e7c43ac9dcb32462a8e6d77c905.zip |
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
Diffstat (limited to 'cmd/cmd.go')
-rw-r--r-- | cmd/cmd.go | 5 |
1 files changed, 3 insertions, 2 deletions
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") } } |