From f1e4ae3de7b20a311b25e04f5866d7d6e8e9a565 Mon Sep 17 00:00:00 2001 From: tranthang2404 Date: Thu, 18 Dec 2025 18:42:45 +0700 Subject: [PATCH] add return error when list object Signed-off-by: tranthang2404 --- registry/storage/driver/s3-aws/s3.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/registry/storage/driver/s3-aws/s3.go b/registry/storage/driver/s3-aws/s3.go index 39cbed3f2..79b9ec196 100644 --- a/registry/storage/driver/s3-aws/s3.go +++ b/registry/storage/driver/s3-aws/s3.go @@ -1013,11 +1013,13 @@ func (d *driver) Delete(ctx context.Context, path string) error { for { // list all the objects resp, err := d.S3.ListObjectsV2WithContext(ctx, listObjectsInput) - + if err != nil { + return err + } // resp.Contents can only be empty on the first call // if there were no more results to return after the first call, resp.IsTruncated would have been false // and the loop would exit without recalling ListObjects - if err != nil || len(resp.Contents) == 0 { + if len(resp.Contents) == 0 { return storagedriver.PathNotFoundError{Path: path} }