From 847738fd5ed977da7c9135bf757942c5d21f5d56 Mon Sep 17 00:00:00 2001 From: Collin Shoop Date: Mon, 28 Jun 2021 13:16:33 -0400 Subject: [PATCH] storagedriver/s3: fixed a bug in s3 Walk impl preventing ErrSkipDir from stopping gracefully --- registry/storage/driver/s3-aws/s3.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/registry/storage/driver/s3-aws/s3.go b/registry/storage/driver/s3-aws/s3.go index 3d2c6010d..a728be92a 100644 --- a/registry/storage/driver/s3-aws/s3.go +++ b/registry/storage/driver/s3-aws/s3.go @@ -1122,6 +1122,7 @@ func (d *driver) doWalk(parentCtx context.Context, objectCount *int64, path, pre continue } + // walk over file's parent directory if not a duplicate dir := filepath.Dir(walkInfo.Path()) if dir != prevDir { prevDir = dir @@ -1149,7 +1150,8 @@ func (d *driver) doWalk(parentCtx context.Context, objectCount *int64, path, pre if err != nil { if err == storagedriver.ErrSkipDir { - break + // stop early without return error + return false } retError = err return false