aboutsummaryrefslogtreecommitdiff
path: root/internal/pathutil/pathutil.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/pathutil/pathutil.go')
-rw-r--r--internal/pathutil/pathutil.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/internal/pathutil/pathutil.go b/internal/pathutil/pathutil.go
index 6a7286e1..26ea76b6 100644
--- a/internal/pathutil/pathutil.go
+++ b/internal/pathutil/pathutil.go
@@ -9,7 +9,9 @@ import (
"strings"
)
-// Clean cleans up given path and returns a relative path that goes straight down.
+// Clean cleans up given path and returns a relative path that goes straight
+// down to prevent path traversal.
func Clean(p string) string {
+ p = strings.ReplaceAll(p, `\`, "/")
return strings.Trim(path.Clean("/"+p), "/")
}