fix: virtual path, support mount to root path

pull/874/head
Xhofe 2022-04-01 09:40:08 +08:00
parent b52e1e8be3
commit 9daeaf7562
2 changed files with 9 additions and 0 deletions

View File

@ -207,6 +207,9 @@ func GetAccountsByPath(path string) []Account {
if bIndex != -1 {
name = name[:bIndex]
}
if name == "/" {
name = ""
}
// 不是这个账号
if path != name && !strings.HasPrefix(path, name+"/") {
continue
@ -253,6 +256,9 @@ func GetAccountFilesByPath(prefix string) []File {
continue
}
full := utils.ParsePath(v.Name)
if len(full) <= len(prefix) {
continue
}
// 不是以prefix为前缀
if !strings.HasPrefix(full, prefix+"/") && prefix != "/" {
continue

View File

@ -38,6 +38,9 @@ func ParsePath(rawPath string) (*model.Account, string, base.Driver, error) {
if bIndex != -1 {
name = name[:bIndex]
}
if name == "/" {
name = ""
}
return &account, strings.TrimPrefix(rawPath, name), driver, nil
}