From e15955f7d0c73fdccd8481da4051b01f8370695f Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Mon, 8 Feb 2021 15:22:15 -0500 Subject: [PATCH] copy: provide compression info about copied blobs When copying a compressed blob without making any modifications to it, set the CompressionFormat in the returned BlobInfo to reflect the compression algorithm that was used to compress the blob. Signed-off-by: Nalin Dahyabhai --- copy/copy.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/copy/copy.go b/copy/copy.go index fb89d98514..4f7d45a1c8 100644 --- a/copy/copy.go +++ b/copy/copy.go @@ -1353,7 +1353,11 @@ func (c *copier) copyBlobFromStream(ctx context.Context, srcStream io.Reader, sr compressionOperation = types.PreserveOriginal inputInfo = srcInfo uploadCompressorName = srcCompressorName - uploadCompressionFormat = nil + if isCompressed { + uploadCompressionFormat = &compressionFormat + } else { + uploadCompressionFormat = nil + } } // === Encrypt the stream for valid mediatypes if ociEncryptConfig provided