Skip to content

Commit

Permalink
fix: wrong virtual file name
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Jun 14, 2022
1 parent b73dbee commit 097b516
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions internal/operations/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,19 +148,20 @@ func GetAccountVirtualFilesByPath(prefix string) []driver.FileInfo {
prefix = utils.StandardizationPath(prefix)
set := make(map[string]interface{})
for _, v := range accounts {
// TODO should save a balanced account
// balance account
if utils.IsBalance(v.GetAccount().VirtualPath) {
continue
}
full := v.GetAccount().VirtualPath
if len(full) <= len(prefix) {
virtualPath := v.GetAccount().VirtualPath
if len(virtualPath) <= len(prefix) {
continue
}
// not prefixed with `prefix`
if !strings.HasPrefix(full, prefix+"/") && prefix != "/" {
if !strings.HasPrefix(virtualPath, prefix+"/") && prefix != "/" {
continue
}
name := strings.Split(strings.TrimPrefix(full, prefix), "/")[0]
name := strings.Split(strings.TrimPrefix(virtualPath, prefix), "/")[1]
if _, ok := set[name]; ok {
continue
}
Expand Down

0 comments on commit 097b516

Please sign in to comment.