blob: 5bc3706a75773662ae55caf615ba3dc5f0968737 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
package ctlsock
import (
"path/filepath"
)
// SanitizePath adapts filepath.Clean for FUSE paths.
// 1) It always returns a relative path
// 2) It returns "" instead of "."
// See the TestSanitizePath testcases for examples.
func SanitizePath(path string) string {
clean := filepath.Clean(path)
if clean == "." || clean == "/" {
return ""
}
if clean[0] == '/' {
clean = clean[1:]
}
return clean
}
|