@@ -80,7 +80,19 @@ func DeterministicIDForCollector(collector *troubleshootv1beta2.Collect) string
8080}
8181
8282func selectorToString (selector []string ) string {
83- return strings .Replace (strings .Join (selector , "-" ), "=" , "-" , - 1 )
83+ result := strings .Replace (strings .Join (selector , "-" ), "=" , "-" , - 1 )
84+ // Sanitize characters that are invalid in Windows filenames: < > : " / \ | ? *
85+ // Replace them with underscores to ensure cross-platform compatibility
86+ result = strings .ReplaceAll (result , "*" , "all" )
87+ result = strings .ReplaceAll (result , "?" , "_" )
88+ result = strings .ReplaceAll (result , ":" , "_" )
89+ result = strings .ReplaceAll (result , "<" , "_" )
90+ result = strings .ReplaceAll (result , ">" , "_" )
91+ result = strings .ReplaceAll (result , "|" , "_" )
92+ result = strings .ReplaceAll (result , "\" " , "_" )
93+ result = strings .ReplaceAll (result , "/" , "_" )
94+ result = strings .ReplaceAll (result , "\\ " , "_" )
95+ return result
8496}
8597
8698func pathToString (path string ) string {
0 commit comments