From 48e2373d5b18ed23cac9911beb1c45b931442d91 Mon Sep 17 00:00:00 2001 From: Collin Shoop Date: Thu, 24 Jun 2021 17:47:54 -0400 Subject: [PATCH] storagedriver/s3: Simplified conditional in Walk impl --- registry/storage/driver/s3-aws/s3.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/registry/storage/driver/s3-aws/s3.go b/registry/storage/driver/s3-aws/s3.go index 5f8e7dc8f..2c0b9d08d 100644 --- a/registry/storage/driver/s3-aws/s3.go +++ b/registry/storage/driver/s3-aws/s3.go @@ -1210,12 +1210,10 @@ func (d *driver) doWalk(parentCtx context.Context, objectCount *int64, path, pre return false } - if walkDirectories { - if walkInfo.IsDir() { - if err := d.doWalk(ctx, objectCount, *walkInfo.prefix, prefix, walkDirectories, f); err != nil { - retError = err - return false - } + if walkInfo.IsDir() && walkDirectories { + if err := d.doWalk(ctx, objectCount, *walkInfo.prefix, prefix, walkDirectories, f); err != nil { + retError = err + return false } } }