mirror of
https://github.com/wahyd4/harbor.git
synced 2026-08-18 17:26:33 +10:00
bug fix: modify the implements of checking whether project name is in lower case
This commit is contained in:
+5
-4
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user