17 lines
248 B
Go
17 lines
248 B
Go
|
package util
|
||
|
|
||
|
import (
|
||
|
"path/filepath"
|
||
|
"regexp"
|
||
|
)
|
||
|
|
||
|
var mountPointPattern = regexp.MustCompile(`^/[\w/.-]*$`)
|
||
|
|
||
|
func IsValidMountPoint(mp string) bool {
|
||
|
if !mountPointPattern.MatchString(mp) {
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
return filepath.Clean(mp) == mp
|
||
|
}
|