feat(botfilter): add normalisePath
This commit is contained in:
1 parent
a150d3a74e
commit
cc326c1736
1 file changed
+12
@@ -85,3 +85,15 @@ func normaliseExtensions(values []string) []string {
|
||||
return result
|
||||
}
|
||||
|
||||
func normalisePath(value string) string {
|
||||
value = strings.TrimSpace(value)
|
||||
if value == "" {
|
||||
return ""
|
||||
}
|
||||
value = strings.ReplaceAll(value, "\\", "/")
|
||||
if !strings.HasPrefix(value, "/") {
|
||||
value = "/" + value
|
||||
}
|
||||
return strings.ToLower(pathpkg.Clean(value))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user