From b81b55b0c1e25f6761a7cee01c89bba16e0c909b Mon Sep 17 00:00:00 2001 From: Tan Jiang Date: Mon, 12 Mar 2018 16:07:06 +0800 Subject: [PATCH] Extend the length of project name in request validation --- src/ui/api/project.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/api/project.go b/src/ui/api/project.go index c70693ec3..8544ca14c 100644 --- a/src/ui/api/project.go +++ b/src/ui/api/project.go @@ -42,7 +42,7 @@ type ProjectAPI struct { project *models.Project } -const projectNameMaxLen int = 30 +const projectNameMaxLen int = 255 const projectNameMinLen int = 2 const restrictedNameChars = `[a-z0-9]+(?:[._-][a-z0-9]+)*` @@ -491,7 +491,7 @@ func (p *ProjectAPI) Logs() { func validateProjectReq(req *models.ProjectRequest) error { pn := req.Name if isIllegalLength(req.Name, projectNameMinLen, projectNameMaxLen) { - return fmt.Errorf("Project name is illegal in length. (greater than 2 or less than 30)") + return fmt.Errorf("Project name is illegal in length. (greater than %d or less than %d)", projectNameMaxLen, projectNameMinLen) } validProjectName := regexp.MustCompile(`^` + restrictedNameChars + `$`) legal := validProjectName.MatchString(pn)