mirror of
https://github.com/gogs/gogs.git
synced 2025-12-22 00:00:07 +01:00
pathutil: check both styles of os.PathSeparator (#7020)
This commit is contained in:
@@ -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), "/")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user