Skip to content

Commit

Permalink
Merge pull request containerd#9149 from jsturtevant/cherry-pick-9142-…
Browse files Browse the repository at this point in the history
…on-1-7
  • Loading branch information
dmcgowan authored Oct 6, 2023
2 parents 72e0200 + 6ca0aeb commit 8664fca
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions image.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,15 @@ func (i *image) getLayers(ctx context.Context, platform platforms.MatchComparer,
if err != nil {
return nil, fmt.Errorf("failed to resolve rootfs: %w", err)
}
if len(diffIDs) != len(manifest.Layers) {

// parse out the image layers from oci artifact layers
imageLayers := []ocispec.Descriptor{}
for _, ociLayer := range manifest.Layers {
if images.IsLayerType(ociLayer.MediaType) {
imageLayers = append(imageLayers, ociLayer)
}
}
if len(diffIDs) != len(imageLayers) {
return nil, errors.New("mismatched image rootfs and manifest layers")
}
layers := make([]rootfs.Layer, len(diffIDs))
Expand All @@ -447,7 +455,7 @@ func (i *image) getLayers(ctx context.Context, platform platforms.MatchComparer,
MediaType: ocispec.MediaTypeImageLayer,
Digest: diffIDs[i],
}
layers[i].Blob = manifest.Layers[i]
layers[i].Blob = imageLayers[i]
}
return layers, nil
}
Expand Down

0 comments on commit 8664fca

Please sign in to comment.