diff --git a/internal/experimental/registry/cache.go b/internal/experimental/registry/cache.go index 19ceb86ea..fbd62562a 100644 --- a/internal/experimental/registry/cache.go +++ b/internal/experimental/registry/cache.go @@ -122,10 +122,14 @@ func (cache *Cache) FetchReference(ref *Reference) (*CacheRefSummary, error) { contentLayer = &layer } } - if contentLayer.Size == 0 { + if contentLayer == nil { return &r, errors.New( fmt.Sprintf("manifest does not contain a layer with mediatype %s", HelmChartContentLayerMediaType)) } + if contentLayer.Size == 0 { + return &r, errors.New( + fmt.Sprintf("manifest layer with mediatype %s is of size 0", HelmChartContentLayerMediaType)) + } r.ContentLayer = contentLayer info, err := cache.ociStore.Info(ctx(cache.out, cache.debug), contentLayer.Digest) if err != nil { diff --git a/internal/experimental/registry/constants.go b/internal/experimental/registry/constants.go index e0f17fe61..dafb3c9e5 100644 --- a/internal/experimental/registry/constants.go +++ b/internal/experimental/registry/constants.go @@ -21,7 +21,7 @@ const ( HelmChartConfigMediaType = "application/vnd.cncf.helm.config.v1+json" // HelmChartContentLayerMediaType is the reserved media type for Helm chart package content - HelmChartContentLayerMediaType = "application/vnd.cncf.helm.chart.content.layer.v1+tar" + HelmChartContentLayerMediaType = "application/tar+gzip" ) // KnownMediaTypes returns a list of layer mediaTypes that the Helm client knows about