Skip to content

Commit

Permalink
Merge pull request #137 from opcr-io/allow_layers_to_not_be_gzip
Browse files Browse the repository at this point in the history
Allow images to not be gzip
  • Loading branch information
carabasdaniel authored Apr 5, 2023
2 parents 40eccab + 417da27 commit 9d06e7b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/app/rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func (c *PolicyApp) tarballReferencedByOtherManifests(ociClient *oci.Oci, ref *o
return false, err
}
for _, layer := range manifest.Layers {
if layer.MediaType == ocispec.MediaTypeImageLayerGzip && layer.Digest == ref.Digest {
if (layer.MediaType == ocispec.MediaTypeImageLayerGzip || layer.MediaType == ocispec.MediaTypeImageLayer) && layer.Digest == ref.Digest {
return true, nil
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/oci/oci.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,15 +302,15 @@ func (o *Oci) GetTarballAndConfigLayerDescriptor(ctx context.Context, descriptor
}

for _, layer := range manifest.Layers {
if layer.MediaType == ocispec.MediaTypeImageLayerGzip {
if layer.MediaType == ocispec.MediaTypeImageLayerGzip || layer.MediaType == ocispec.MediaTypeImageLayer {
tarballDescriptor, err := o.ociStore.Resolve(ctx, layer.Digest.String())
if err != nil {
return nil, nil, err
}
return &tarballDescriptor, &configDescriptor, nil
}
}
return nil, nil, nil
return nil, nil, errors.New("could not find tarball and config descriptors")
}

func (o *Oci) GetManifest(descriptor *ocispec.Descriptor) (*ocispec.Manifest, error) {
Expand Down

0 comments on commit 9d06e7b

Please sign in to comment.