mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-10-15 10:07:24 +00:00
more sanitize
This commit is contained in:
1 parent
7742980426
commit
cefc09a41b
5 files changed
+22
-15
No files matched your search
+4
-2
@@ -24,9 +24,11 @@ func DirIsAccessible(filename string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Remove leading '/', remove '..'
|
||||
func PathSanitize(path string) (result string) {
|
||||
// Remove leading '/', remove '..', '$' and '`'
|
||||
func SanitizePath(path string) (result string) {
|
||||
result = strings.Replace(path, "..", "", -1)
|
||||
result = strings.Replace(result, "$", "", -1)
|
||||
result = strings.Replace(result, "`", "", -1)
|
||||
result = strings.TrimLeft(result, "/")
|
||||
return
|
||||
}
|
||||
Reference in new issue
Block a user