From 03d312763f9a7969eedcc836800e6cc2e25003b1 Mon Sep 17 00:00:00 2001 From: Jamie Poole Date: Thu, 19 Sep 2019 14:13:16 +0100 Subject: [PATCH] Ignore object if it is the current directory Signed-off-by: Jamie Poole --- pkg/objstore/s3/s3.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/objstore/s3/s3.go b/pkg/objstore/s3/s3.go index 96e0bf0082..fd944085eb 100644 --- a/pkg/objstore/s3/s3.go +++ b/pkg/objstore/s3/s3.go @@ -239,6 +239,10 @@ func (b *Bucket) Iter(ctx context.Context, dir string, f func(string) error) err if object.Key == "" { continue } + // The s3 client can also return the directory itself in the ListObjects call above + if object.Key == dir { + continue + } if err := f(object.Key); err != nil { return err }