mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 11:55:40 +01:00
Fixed issues found by staticcheck. (#227)
This commit is contained in:
parent
2ac7940206
commit
56a047cdde
2 changed files with 5 additions and 7 deletions
|
|
@ -29,9 +29,7 @@ var invalidRune = regexp.MustCompile(`[^+\-a-z0-9]+`) // invalid runes + `_`
|
|||
// specifies valid runes as 'a' to 'z', '0' to '9' and '+', '-', '_'.
|
||||
func CleanFileName(s string) string {
|
||||
s = strings.ToLower(s)
|
||||
if strings.HasSuffix(s, ".json") {
|
||||
s = s[:len(s)-len(".json")]
|
||||
}
|
||||
s = strings.TrimSuffix(s, ".json")
|
||||
return invalidRune.ReplaceAllString(s, "_") + ".json"
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue