Allow for images with artifacts to pull
Signed-off-by: James Sturtevant <jstur@microsoft.com>
This commit is contained in:
		
							
								
								
									
										12
									
								
								image.go
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								image.go
									
									
									
									
									
								
							| @@ -379,7 +379,15 @@ func (i *image) getLayers(ctx context.Context, manifest ocispec.Manifest) ([]roo | ||||
| 	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)) | ||||
| @@ -389,7 +397,7 @@ func (i *image) getLayers(ctx context.Context, manifest ocispec.Manifest) ([]roo | ||||
| 			MediaType: ocispec.MediaTypeImageLayer, | ||||
| 			Digest:    diffIDs[i], | ||||
| 		} | ||||
| 		layers[i].Blob = manifest.Layers[i] | ||||
| 		layers[i].Blob = imageLayers[i] | ||||
| 	} | ||||
| 	return layers, nil | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 James Sturtevant
					James Sturtevant