aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/main.go b/main.go
index 2595a83..79ef4df 100644
--- a/main.go
+++ b/main.go
@@ -334,10 +334,10 @@ func (gf *GarageFile) readDirRoot(count int) ([]fs.FileInfo, error) {
}
func (gf *GarageFile) readDirChild(count int) ([]fs.FileInfo, error) {
- prefix := gf.path.key
- if prefix[len(prefix)-1:] != "/" {
- prefix = prefix + "/"
- }
+ prefix := gf.path.key
+ if len(prefix) > 0 && prefix[len(prefix)-1:] != "/" {
+ prefix = prefix + "/"
+ }
objs_info := gf.mc.ListObjects(gf.ctx, gf.path.bucket, minio.ListObjectsOptions{
Prefix: prefix,