Browse Source

任务名优化, 任务名只能以数字字母开头

tags/v1.21.8^2
ychao_1983 4 years ago
parent
commit
2295370b54
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      routers/repo/cloudbrain.go

+ 6
- 1
routers/repo/cloudbrain.go View File

@@ -91,7 +91,12 @@ func cutString(str string, lens int) string {
func jobNamePrefixValid(s string) string {
lowStr := strings.ToLower(s)
re := regexp.MustCompile(`[^a-z0-9_\\-]+`)
return re.ReplaceAllString(lowStr, "")
//去掉非法字符
removeSpecial := re.ReplaceAllString(lowStr, "")
//任务名以数字字母开头,去掉非法前缀
re = regexp.MustCompile(`^[_\\-]+`)
return re.ReplaceAllString(removeSpecial, "")

}

func cloudBrainNewDataPrepare(ctx *context.Context) error{


Loading…
Cancel
Save