From 513f2a0dc94c5f36d9d6e1455b562c192664a4c2 Mon Sep 17 00:00:00 2001 From: peusebiu Date: Thu, 3 Oct 2024 22:27:58 +0300 Subject: [PATCH] fix(s3): fix check in dedupe logic (#2700) cache.HasBlob() looks in both buckets: duplicates and original blobs Because we want to check if the blob is in original bucket let's use cache.GetBlob() because it's looking only in original bucket. Signed-off-by: Eusebiu Petu --- pkg/storage/imagestore/imagestore.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/storage/imagestore/imagestore.go b/pkg/storage/imagestore/imagestore.go index be7ed17a..22db78cd 100644 --- a/pkg/storage/imagestore/imagestore.go +++ b/pkg/storage/imagestore/imagestore.go @@ -1930,7 +1930,7 @@ func (is *ImageStore) dedupeBlobs(ctx context.Context, digest godigest.Digest, d } // cache original blob - if ok := is.cache.HasBlob(digest, originalBlob); !ok { + if _, err := is.cache.GetBlob(digest); err != nil { if err := is.cache.PutBlob(digest, originalBlob); err != nil { return err }