mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-03 14:37:44 +01:00
bug fix: modify the implements of checking whether project name is in lower case
This commit is contained in:
parent
96c9e4c202
commit
fc8fbbcb98
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user