Skip to content

Commit

Permalink
resolved comments
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaoxuan Wang <[email protected]>
  • Loading branch information
wangxiaoxuan273 committed Jan 11, 2024
1 parent de79a2e commit 20af59f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions content/oci/oci.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ func (s *Store) GC(ctx context.Context) error {
reachableNodes := s.graph.DigestSet()

// clean up garbage blobs in the storage
rootpath := filepath.Join(s.root, "blobs")
rootpath := filepath.Join(s.root, ocispec.ImageBlobsDir)
algDirs, err := os.ReadDir(rootpath)
if err != nil {
return err
Expand All @@ -510,9 +510,8 @@ func (s *Store) GC(ctx context.Context) error {
}

Check warning on line 510 in content/oci/oci.go

View check run for this annotation

Codecov / codecov/patch

content/oci/oci.go#L509-L510

Added lines #L509 - L510 were not covered by tests
dgst := digestEntry.Name()
blobDigest := digest.NewDigestFromEncoded(digest.Algorithm(alg), dgst)
err := blobDigest.Validate()
// skip irrelevant content
if err != nil {
if err := blobDigest.Validate(); err != nil {
// skip irrelevant content
continue
}
if !reachableNodes.Contains(blobDigest) {
Expand Down

0 comments on commit 20af59f

Please sign in to comment.