feat(alias): auto flatten if only one root

This commit is contained in:
Andy Hsu
2023-03-14 20:25:52 +08:00
parent b8bc94306d
commit 443f5ffbcc
2 changed files with 17 additions and 6 deletions

View File

@ -38,7 +38,10 @@ func getPair(path string) (string, string) {
return stdpath.Base(path), path
}
func getRootAndPath(path string) (string, string) {
func (d *Alias) getRootAndPath(path string) (string, string) {
if d.autoFlatten {
return d.oneKey, path
}
path = strings.TrimPrefix(path, "/")
parts := strings.SplitN(path, "/", 2)
if len(parts) == 1 {