mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
batch: repl: A missing prefix in the remote source will fail replication (#20365)
When the prefix field is not provided in the remote source of a yaml replication job, the code fails to do listing and makes replication successful. This commit fixes it.
This commit is contained in:
parent
f05641c3c6
commit
aaf4fb1184
@ -388,7 +388,11 @@ func (r *BatchJobReplicateV1) StartFromSource(ctx context.Context, api ObjectLay
|
|||||||
|
|
||||||
objInfoCh := make(chan miniogo.ObjectInfo, 1)
|
objInfoCh := make(chan miniogo.ObjectInfo, 1)
|
||||||
go func() {
|
go func() {
|
||||||
for _, prefix := range r.Source.Prefix.F() {
|
prefixes := r.Source.Prefix.F()
|
||||||
|
if len(prefixes) == 0 {
|
||||||
|
prefixes = []string{""}
|
||||||
|
}
|
||||||
|
for _, prefix := range prefixes {
|
||||||
prefixObjInfoCh := c.ListObjects(ctx, r.Source.Bucket, miniogo.ListObjectsOptions{
|
prefixObjInfoCh := c.ListObjects(ctx, r.Source.Bucket, miniogo.ListObjectsOptions{
|
||||||
Prefix: strings.TrimSpace(prefix),
|
Prefix: strings.TrimSpace(prefix),
|
||||||
WithVersions: minioSrc,
|
WithVersions: minioSrc,
|
||||||
|
Loading…
Reference in New Issue
Block a user