feat: obj list api

This commit is contained in:
Noah Hsu
2022-06-27 19:51:23 +08:00
parent c6007aa9e6
commit 7c0b86a9cd
10 changed files with 157 additions and 24 deletions

View File

@ -185,6 +185,9 @@ func GetAccountVirtualFilesByPath(prefix string) []model.Obj {
return accounts[i].GetAccount().Index < accounts[j].GetAccount().Index
})
prefix = utils.StandardizePath(prefix)
if prefix == "/" {
prefix = ""
}
set := make(map[string]interface{})
for _, v := range accounts {
// TODO should save a balanced account
@ -197,7 +200,7 @@ func GetAccountVirtualFilesByPath(prefix string) []model.Obj {
continue
}
// not prefixed with `prefix`
if !strings.HasPrefix(virtualPath, prefix+"/") && prefix != "/" {
if !strings.HasPrefix(virtualPath, prefix+"/") {
continue
}
name := strings.Split(strings.TrimPrefix(virtualPath, prefix), "/")[1]