mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
fix: gateway Walk() implementation to list correct contents (#10131)
closes #10122
This commit is contained in:
parent
4b22b288a6
commit
6529dcb3b5
@ -59,29 +59,32 @@ func (l *GatewayLocker) NewNSLock(ctx context.Context, bucket string, objects ..
|
|||||||
// Walk - implements common gateway level Walker, to walk on all objects recursively at a prefix
|
// Walk - implements common gateway level Walker, to walk on all objects recursively at a prefix
|
||||||
func (l *GatewayLocker) Walk(ctx context.Context, bucket, prefix string, results chan<- ObjectInfo, opts ObjectOptions) error {
|
func (l *GatewayLocker) Walk(ctx context.Context, bucket, prefix string, results chan<- ObjectInfo, opts ObjectOptions) error {
|
||||||
walk := func(ctx context.Context, bucket, prefix string, results chan<- ObjectInfo) error {
|
walk := func(ctx context.Context, bucket, prefix string, results chan<- ObjectInfo) error {
|
||||||
var marker string
|
go func() {
|
||||||
|
|
||||||
// Make sure the results channel is ready to be read when we're done.
|
// Make sure the results channel is ready to be read when we're done.
|
||||||
defer close(results)
|
defer close(results)
|
||||||
|
|
||||||
|
var marker string
|
||||||
|
|
||||||
for {
|
for {
|
||||||
// set maxKeys to '0' to list maximum possible objects in single call.
|
// set maxKeys to '0' to list maximum possible objects in single call.
|
||||||
loi, err := l.ObjectLayer.ListObjects(ctx, bucket, prefix, marker, "", 0)
|
loi, err := l.ObjectLayer.ListObjects(ctx, bucket, prefix, marker, "", 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
logger.LogIf(ctx, err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
marker = loi.NextMarker
|
marker = loi.NextMarker
|
||||||
for _, obj := range loi.Objects {
|
for _, obj := range loi.Objects {
|
||||||
select {
|
select {
|
||||||
case results <- obj:
|
case results <- obj:
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return nil
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !loi.IsTruncated {
|
if !loi.IsTruncated {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user