Skip to content

Commit 212dbb2

Browse files
committed
fix: empty storage virtual file
1 parent 53fd098 commit 212dbb2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

internal/operations/storage.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ func GetStorageVirtualFilesByPath(prefix string) []model.Obj {
185185
return storages[i].GetStorage().Index < storages[j].GetStorage().Index
186186
})
187187
prefix = utils.StandardizePath(prefix)
188-
if prefix == "/" {
189-
prefix = ""
188+
if prefix != "/" {
189+
prefix += "/"
190190
}
191191
set := make(map[string]interface{})
192192
for _, v := range storages {
@@ -200,10 +200,10 @@ func GetStorageVirtualFilesByPath(prefix string) []model.Obj {
200200
continue
201201
}
202202
// not prefixed with `prefix`
203-
if !strings.HasPrefix(virtualPath, prefix+"/") {
203+
if !strings.HasPrefix(virtualPath, prefix) {
204204
continue
205205
}
206-
name := strings.Split(strings.TrimPrefix(virtualPath, prefix), "/")[1]
206+
name := strings.Split(strings.TrimPrefix(virtualPath, prefix), "/")[0]
207207
if _, ok := set[name]; ok {
208208
continue
209209
}

0 commit comments

Comments
 (0)