Skip to content

Commit b7535a9

Browse files
authored
fix: ignore the ErrBlobUnknown during stat blob (#120)
Signed-off-by: chlins <[email protected]>
1 parent 962d98f commit b7535a9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/storage/distribution/distribution.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package distribution
1818

1919
import (
2020
"context"
21+
"errors"
2122
"fmt"
2223
"io"
2324
"regexp"
@@ -258,6 +259,11 @@ func (s *storage) StatBlob(ctx context.Context, repo, digest string) (bool, erro
258259

259260
_, err = repository.Blobs(ctx).Stat(ctx, godigest.Digest(digest))
260261
if err != nil {
262+
// If the blob not found, distribution will return ErrBlobUnknown.
263+
if errors.Is(err, distribution.ErrBlobUnknown) {
264+
return false, nil
265+
}
266+
261267
return false, err
262268
}
263269

0 commit comments

Comments
 (0)