From c00304fd39b2fa444cd67bad3f3ddf05c363644f Mon Sep 17 00:00:00 2001 From: Kohei Tokunaga Date: Fri, 13 Dec 2024 23:05:37 +0900 Subject: [PATCH] Call callback only for unlazied contents Signed-off-by: Kohei Tokunaga --- cache/refs.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cache/refs.go b/cache/refs.go index 235fa0c66c44..ad5edf5c6b16 100644 --- a/cache/refs.go +++ b/cache/refs.go @@ -848,6 +848,11 @@ func getBlobWithCompression(ctx context.Context, cs content.Store, desc ocispecs } func walkBlob(ctx context.Context, cs content.Store, desc ocispecs.Descriptor, f func(ocispecs.Descriptor) bool) error { + if _, err := cs.Info(ctx, desc.Digest); errors.Is(err, cerrdefs.ErrNotFound) { + return nil // this blob doesn't exist in the content store. Don't call the callback. + } else if err != nil { + return err + } if !f(desc) { return nil }