From 26dff699fb102575e0449b40e3a77f9465af723d Mon Sep 17 00:00:00 2001 From: Sandeep Sukhani Date: Mon, 9 May 2022 12:57:34 +0530 Subject: [PATCH] skip empty object key returned by some s3 compatible storage while listing boltdb-shipper index --- pkg/storage/stores/shipper/storage/cached_client.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/storage/stores/shipper/storage/cached_client.go b/pkg/storage/stores/shipper/storage/cached_client.go index af725a00cb59..2d3c839724e7 100644 --- a/pkg/storage/stores/shipper/storage/cached_client.go +++ b/pkg/storage/stores/shipper/storage/cached_client.go @@ -153,6 +153,11 @@ func (c *cachedObjectClient) buildCache(ctx context.Context, forceRefresh bool) c.tableNames = []client.StorageCommonPrefix{} for _, object := range objects { + // The s3 client can also return the directory itself in the ListObjects. + if object.Key == "" { + continue + } + ss := strings.Split(object.Key, delimiter) if len(ss) < 2 || len(ss) > 3 { return fmt.Errorf("invalid key: %s", object.Key)