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

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

View File

@ -904,7 +904,15 @@ func (e *ETCD) listSnapshots(ctx context.Context, snapshotDir string) ([]Snapsho
return nil, err 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 { for obj := range objects {
if obj.Err != nil { if obj.Err != nil {