Skip to content

Commit

Permalink
fix: empty storage virtual file
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Jul 27, 2022
1 parent 53fd098 commit 212dbb2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/operations/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ func GetStorageVirtualFilesByPath(prefix string) []model.Obj {
return storages[i].GetStorage().Index < storages[j].GetStorage().Index
})
prefix = utils.StandardizePath(prefix)
if prefix == "/" {
prefix = ""
if prefix != "/" {
prefix += "/"
}
set := make(map[string]interface{})
for _, v := range storages {
Expand All @@ -200,10 +200,10 @@ func GetStorageVirtualFilesByPath(prefix string) []model.Obj {
continue
}
// not prefixed with `prefix`
if !strings.HasPrefix(virtualPath, prefix+"/") {
if !strings.HasPrefix(virtualPath, prefix) {
continue
}
name := strings.Split(strings.TrimPrefix(virtualPath, prefix), "/")[1]
name := strings.Split(strings.TrimPrefix(virtualPath, prefix), "/")[0]
if _, ok := set[name]; ok {
continue
}
Expand Down

0 comments on commit 212dbb2

Please sign in to comment.