From c14b8307b1d01e682c99d14da3695c63d27b5ebc Mon Sep 17 00:00:00 2001 From: Toshiki Teramura Date: Thu, 25 Apr 2024 19:52:49 +0900 Subject: [PATCH] Do not push the config blob if it is empty --- ocipkg/src/distribution/mod.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ocipkg/src/distribution/mod.rs b/ocipkg/src/distribution/mod.rs index 4099fec..678e118 100644 --- a/ocipkg/src/distribution/mod.rs +++ b/ocipkg/src/distribution/mod.rs @@ -31,11 +31,13 @@ pub fn push_image(path: &Path) -> Result<()> { entry.read_to_end(&mut buf)?; client.push_blob(&buf)?; } - let digest = Digest::new(manifest.config().digest())?; - let mut entry = ar.get_blob(&digest)?; - let mut buf = Vec::new(); - entry.read_to_end(&mut buf)?; - client.push_blob(&buf)?; + if manifest.config().media_type() != &MediaType::EmptyJSON { + let digest = Digest::new(manifest.config().digest())?; + let mut entry = ar.get_blob(&digest)?; + let mut buf = Vec::new(); + entry.read_to_end(&mut buf)?; + client.push_blob(&buf)?; + } client.push_manifest(&image_name.reference, &manifest)?; } Ok(())