@@ -31,7 +31,6 @@ import (
3131
3232const (
3333 identifierMaxLength = 76
34- identifierSeparator = "-"
3534 identifierSignatureLength = 8
3635)
3736
@@ -250,27 +249,18 @@ func newData(t tig.T, seed, parent Data) Data {
250249func defaultIdentifierHashing (names ... string ) string {
251250 // Notes: identifier MAY be used for namespaces, image names, etc.
252251 // So, the rules are stringent on what it can contain.
253- replaceWith := [] byte ( identifierSeparator )
254- name := strings .ToLower (strings .Join (names , string ( replaceWith ) ))
252+ // Join names without separator to avoid '-' which causes display issues in progress output
253+ name := strings .ToLower (strings .Join (names , "" ))
255254 // Ensure we have a unique identifier despite characters replacements
256255 // (well, as unique as the names collection being passed)
257256 signature := fmt .Sprintf ("%x" , sha256 .Sum256 ([]byte (name )))[0 :identifierSignatureLength ]
258- // Make sure we do not use any unsafe characters
259- safeName := regexp .MustCompile (`[^a-z0-9-]+` )
260- // And we avoid repeats of the separator
261- noRepeat := regexp .MustCompile (fmt .Sprintf (`[%s]{2,}` , replaceWith ))
262- escapedName := safeName .ReplaceAll ([]byte (name ), replaceWith )
263- escapedName = noRepeat .ReplaceAll (escapedName , replaceWith )
264- // Do not allow trailing or leading dash (as that may stutter)
265- name = strings .Trim (string (escapedName ), string (replaceWith ))
257+ safeName := regexp .MustCompile (`[^a-z0-9]+` )
258+ escapedName := safeName .ReplaceAll ([]byte (name ), []byte ("" ))
259+ name = string (escapedName )
266260
267261 // Ensure we will never go above 76 characters in length (with signature)
268- if len (name ) > (identifierMaxLength - len (signature )) {
269- name = name [0 : identifierMaxLength - identifierSignatureLength - len (identifierSeparator )]
270- }
271-
272- if name [len (name )- 1 :] != identifierSeparator {
273- signature = identifierSeparator + signature
262+ if len (name ) > (identifierMaxLength - identifierSignatureLength ) {
263+ name = name [0 : identifierMaxLength - identifierSignatureLength ]
274264 }
275265
276266 return name + signature
0 commit comments