From 097b516dc559b9a74ccc2d83aa31b24e09e6a447 Mon Sep 17 00:00:00 2001 From: Noah Hsu Date: Tue, 14 Jun 2022 22:23:10 +0800 Subject: [PATCH] fix: wrong virtual file name --- internal/operations/account.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/operations/account.go b/internal/operations/account.go index 53302b97b68..547727026bd 100644 --- a/internal/operations/account.go +++ b/internal/operations/account.go @@ -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 }