photoprism/internal/remote/webdav/path.go

19 lines
269 B
Go
Raw Normal View History

package webdav
import (
"path"
"strings"
)
func trimPath(dir string) string {
if dir = strings.Trim(path.Clean(dir), "/"); dir != "." && dir != ".." {
return dir
}
return ""
}
func splitPath(dir string) []string {
return strings.Split(trimPath(dir), "/")
}