bug fix: modify the implements of checking whether project name is in lower case

This commit is contained in:
Wenkai Yin 2016-06-15 13:31:00 +08:00
parent 96c9e4c202
commit fc8fbbcb98

View File

@ -18,6 +18,7 @@ package api
import (
"fmt"
"net/http"
"strings"
"unicode"
"github.com/vmware/harbor/dao"
@ -294,10 +295,10 @@ func validateProjectReq(req projectReq) error {
if isContainIllegalChar(req.ProjectName, []string{"~", "-", "$", "\\", "[", "]", "{", "}", "(", ")", "&", "^", "%", "*", "<", ">", "\"", "'", "/", "?", "@"}) {
return fmt.Errorf("project name contains illegal characters")
}
for _, v := range pn {
if !unicode.IsLower(v) {
return fmt.Errorf("project name must be in lower case")
}
if pn != strings.ToLower(pn) {
return fmt.Errorf("project name must be in lower case")
}
return nil
}