From aabdec1778afd0b7d84135e7bd3d4985b4bc82b2 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Sat, 5 Dec 2020 23:16:44 -0800 Subject: [PATCH] handle foreign mediatypes on push Signed-off-by: Tonis Tiigi --- util/compression/compression.go | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/util/compression/compression.go b/util/compression/compression.go index f63d2934..654b0563 100644 --- a/util/compression/compression.go +++ b/util/compression/compression.go @@ -99,17 +99,21 @@ func detectCompressionType(cr io.Reader) (Type, error) { } var toDockerLayerType = map[string]string{ - ocispec.MediaTypeImageLayer: images.MediaTypeDockerSchema2Layer, - images.MediaTypeDockerSchema2Layer: images.MediaTypeDockerSchema2Layer, - ocispec.MediaTypeImageLayerGzip: images.MediaTypeDockerSchema2LayerGzip, - images.MediaTypeDockerSchema2LayerGzip: images.MediaTypeDockerSchema2LayerGzip, + ocispec.MediaTypeImageLayer: images.MediaTypeDockerSchema2Layer, + images.MediaTypeDockerSchema2Layer: images.MediaTypeDockerSchema2Layer, + ocispec.MediaTypeImageLayerGzip: images.MediaTypeDockerSchema2LayerGzip, + images.MediaTypeDockerSchema2LayerGzip: images.MediaTypeDockerSchema2LayerGzip, + images.MediaTypeDockerSchema2LayerForeign: images.MediaTypeDockerSchema2Layer, + images.MediaTypeDockerSchema2LayerForeignGzip: images.MediaTypeDockerSchema2LayerGzip, } var toOCILayerType = map[string]string{ - ocispec.MediaTypeImageLayer: ocispec.MediaTypeImageLayer, - images.MediaTypeDockerSchema2Layer: ocispec.MediaTypeImageLayer, - ocispec.MediaTypeImageLayerGzip: ocispec.MediaTypeImageLayerGzip, - images.MediaTypeDockerSchema2LayerGzip: ocispec.MediaTypeImageLayerGzip, + ocispec.MediaTypeImageLayer: ocispec.MediaTypeImageLayer, + images.MediaTypeDockerSchema2Layer: ocispec.MediaTypeImageLayer, + ocispec.MediaTypeImageLayerGzip: ocispec.MediaTypeImageLayerGzip, + images.MediaTypeDockerSchema2LayerGzip: ocispec.MediaTypeImageLayerGzip, + images.MediaTypeDockerSchema2LayerForeign: ocispec.MediaTypeImageLayer, + images.MediaTypeDockerSchema2LayerForeignGzip: ocispec.MediaTypeImageLayerGzip, } func convertLayerMediaType(mediaType string, oci bool) string {