chore: Merge pull request #874 from Xhofe/dev

support mount to root path
pull/905/head v2.3.1
Xhofe 2022-04-01 09:42:37 +08:00 committed by GitHub
commit 876579ea3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

View File

@ -3,8 +3,6 @@ name: build_docker
on:
push:
branches: [ v2 ]
pull_request:
branches: [ v2 ]
jobs:
build_docker:

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
}