(name []string, max int)
| 16 | } |
| 17 | |
| 18 | func SafeConcatNameMax(name []string, max int) string { |
| 19 | fullPath := strings.Join(name, "-") |
| 20 | if len(fullPath) > max { |
| 21 | digest := sha256.Sum256([]byte(fullPath)) |
| 22 | return strings.ReplaceAll(fullPath[0:max-8]+"-"+hex.EncodeToString(digest[0:])[0:7], ".-", "-") |
| 23 | } |
| 24 | return fullPath |
| 25 | } |
| 26 | |
| 27 | var convertRegEx1 = regexp.MustCompile(`[\@/\.\:\s]+`) |
| 28 | var convertRegEx2 = regexp.MustCompile(`[^a-z0-9\-]+`) |
no outgoing calls
no test coverage detected