Skip to content

Commit

Permalink
Fix Wave layer invalid checksum due to not closed stream
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Di Tommaso <[email protected]>
  • Loading branch information
pditommaso committed Jan 23, 2023
1 parent 8196ffd commit 20df640
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,12 @@ class Packer {
ContainerLayer layer(Map<String,Path> entries) {
final tar = makeTar(entries, new ByteArrayOutputStream()).toByteArray()
final tarDigest = DigestFunctions.digest(tar)
final gzip = makeGzip(new ByteArrayInputStream(tar), new ByteArrayOutputStream()).toByteArray()
final gzipSize = gzip.length
final gzipDigest = DigestFunctions.digest(gzip)
final data = 'data:' + gzip.encodeBase64()
final gzipStream = new ByteArrayOutputStream()
makeGzip(new ByteArrayInputStream(tar), gzipStream); gzipStream.close()
final gzipBytes = gzipStream.toByteArray()
final gzipSize = gzipBytes.length
final gzipDigest = DigestFunctions.digest(gzipBytes)
final data = 'data:' + gzipBytes.encodeBase64()

return new ContainerLayer(
location: data,
Expand Down

0 comments on commit 20df640

Please sign in to comment.