From 03d312763f9a7969eedcc836800e6cc2e25003b1 Mon Sep 17 00:00:00 2001 From: Jamie Poole Date: Thu, 19 Sep 2019 14:13:16 +0100 Subject: [PATCH 1/2] 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 } From dddfa7647197c44399cb4aaf2149286f7242b935 Mon Sep 17 00:00:00 2001 From: Jamie Poole Date: Fri, 20 Sep 2019 22:07:44 +0100 Subject: [PATCH 2/2] Add full-stop Signed-off-by: Jamie Poole --- pkg/objstore/s3/s3.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/objstore/s3/s3.go b/pkg/objstore/s3/s3.go index fd944085eb..a8efda1b4b 100644 --- a/pkg/objstore/s3/s3.go +++ b/pkg/objstore/s3/s3.go @@ -239,7 +239,7 @@ 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 + // The s3 client can also return the directory itself in the ListObjects call above. if object.Key == dir { continue }