소스 검색

only allow lowercase letters

非法操作 6 달 전
부모
커밋
caf5251e5e
3개의 변경된 파일6개의 추가작업 그리고 6개의 파일을 삭제
  1. 2 2
      cmd/commandline/bundle/profile.go
  2. 2 2
      cmd/commandline/plugin/profile.go
  3. 2 2
      pkg/entities/plugin_entities/plugin_declaration.go

+ 2 - 2
cmd/commandline/bundle/profile.go

@@ -62,10 +62,10 @@ func (p *profile) checkRule() bool {
 		p.warning = "Name, author and description cannot be empty"
 		return false
 	} else if p.cursor == 0 && !plugin_entities.PluginNameRegex.MatchString(p.inputs[p.cursor].Value()) {
-		p.warning = "Bundle name must be 1-128 characters long, and can only contain letters, numbers, dashes and underscores"
+		p.warning = "Bundle name must be 1-128 characters long, and can only contain lowercase letters, numbers, dashes and underscores"
 		return false
 	} else if p.cursor == 1 && !plugin_entities.AuthorRegex.MatchString(p.inputs[p.cursor].Value()) {
-		p.warning = "Author name must be 1-64 characters long, and can only contain letters, numbers, dashes and underscores"
+		p.warning = "Author name must be 1-64 characters long, and can only contain lowercase letters, numbers, dashes and underscores"
 		return false
 	} else {
 		p.warning = ""

+ 2 - 2
cmd/commandline/plugin/profile.go

@@ -62,10 +62,10 @@ func (p *profile) checkRule() bool {
 		p.warning = "Name, author and description cannot be empty"
 		return false
 	} else if p.cursor == 0 && !plugin_entities.PluginNameRegex.MatchString(p.inputs[p.cursor].Value()) {
-		p.warning = "Plugin name must be 1-128 characters long, and can only contain letters, numbers, dashes and underscores"
+		p.warning = "Plugin name must be 1-128 characters long, and can only contain lowercase letters, numbers, dashes and underscores"
 		return false
 	} else if p.cursor == 1 && !plugin_entities.AuthorRegex.MatchString(p.inputs[p.cursor].Value()) {
-		p.warning = "Author name must be 1-64 characters long, and can only contain letters, numbers, dashes and underscores"
+		p.warning = "Author name must be 1-64 characters long, and can only contain lowercase letters, numbers, dashes and underscores"
 		return false
 	} else {
 		p.warning = ""

+ 2 - 2
pkg/entities/plugin_entities/plugin_declaration.go

@@ -233,8 +233,8 @@ func (p *PluginDeclaration) MarshalJSON() ([]byte, error) {
 }
 
 var (
-	PluginNameRegex = regexp.MustCompile(`^[a-zA-Z0-9_-]{1,128}$`)
-	AuthorRegex     = regexp.MustCompile(`^[a-zA-Z0-9_-]{1,64}$`)
+	PluginNameRegex = regexp.MustCompile(`^[a-z0-9_-]{1,128}$`)
+	AuthorRegex     = regexp.MustCompile(`^[a-z0-9_-]{1,64}$`)
 )
 
 func isPluginName(fl validator.FieldLevel) bool {