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:
Anis Eleuch 2024-09-02 13:36:43 +01:00 committed by GitHub
parent f05641c3c6
commit aaf4fb1184
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -388,7 +388,11 @@ func (r *BatchJobReplicateV1) StartFromSource(ctx context.Context, api ObjectLay
objInfoCh := make(chan miniogo.ObjectInfo, 1)
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{
Prefix: strings.TrimSpace(prefix),
WithVersions: minioSrc,