Skip to content

Commit

Permalink
copy: provide compression info about copied blobs
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
nalind authored and vrothberg committed Feb 25, 2021
1 parent 86298a3 commit e5f19ba
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion copy/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,15 @@ func (c *copier) copyBlobFromStream(ctx context.Context, srcStream io.Reader, sr
compressionOperation = types.PreserveOriginal
inputInfo = srcInfo
uploadCompressorName = srcCompressorName
uploadCompressionFormat = nil
// Remember if the original blob was compressed, and if so how, so that if
// LayerInfosForCopy() returned something that differs from what was in the
// source's manifest, and UpdatedImage() needs to call UpdateLayerInfos(),
// it will be able to correctly derive the MediaType for the copied blob.
if isCompressed {
uploadCompressionFormat = &compressionFormat
} else {
uploadCompressionFormat = nil
}
}

// Perform image encryption for valid mediatypes if ociEncryptConfig provided
Expand Down

0 comments on commit e5f19ba

Please sign in to comment.