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:
parent
8a92544a3e
commit
e1fcd6b742
7 changed files with 48 additions and 3 deletions
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue