account for an s3 folder when listing objects (#3807) (#3812)

* account for an s3 folder when listing objects
This commit is contained in:
Brian Downs 2021-08-09 17:35:14 -07:00 committed by GitHub
parent 12ec437605
commit 18bc38d838
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {