Fix alias issue when tagging performer from stash-box (#4820)

This commit is contained in:
WithoutPants
2024-05-08 12:47:18 +10:00
committed by GitHub
parent 1b99a03847
commit c5abe28375
2 changed files with 18 additions and 0 deletions

View File

@@ -29,3 +29,18 @@ func FromString(s string, sep string) []string {
}
return v
}
// Unique returns a slice containing only unique values from the provided slice.
// The comparison is case-insensitive.
func UniqueFold(s []string) []string {
seen := make(map[string]struct{})
var ret []string
for _, v := range s {
if _, exists := seen[strings.ToLower(v)]; exists {
continue
}
seen[strings.ToLower(v)] = struct{}{}
ret = append(ret, v)
}
return ret
}