From 18bc38d83852154d0a6f7cbc96f9c21aa5603d56 Mon Sep 17 00:00:00 2001 From: Brian Downs Date: Mon, 9 Aug 2021 17:35:14 -0700 Subject: [PATCH] account for an s3 folder when listing objects (#3807) (#3812) * account for an s3 folder when listing objects --- pkg/etcd/etcd.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/etcd/etcd.go b/pkg/etcd/etcd.go index cffe627fe1..1b05856a5c 100644 --- a/pkg/etcd/etcd.go +++ b/pkg/etcd/etcd.go @@ -900,7 +900,15 @@ func (e *ETCD) listSnapshots(ctx context.Context, snapshotDir string) ([]Snapsho return nil, err } - objects := e.s3.client.ListObjects(ctx, e.config.EtcdS3BucketName, minio.ListObjectsOptions{}) + var loo minio.ListObjectsOptions + if e.config.EtcdS3Folder != "" { + loo = minio.ListObjectsOptions{ + Prefix: e.config.EtcdS3Folder, + Recursive: true, + } + } + + objects := e.s3.client.ListObjects(ctx, e.config.EtcdS3BucketName, loo) for obj := range objects { if obj.Err != nil {