fix(image-spec): Several fixes in image-spec#322
Conversation
Signed-off-by: Cezar Craciunoiu <cezar@unikraft.io>
There was a problem hiding this comment.
Pull request overview
This PR fixes two correctness issues in the image-spec package's tarball export path. First, it avoids a potential nil pointer dereference in SaveContent when an image has no Image config. Second, and more importantly, it fixes a corrupt-tarball bug: SaveContent always returns an image index descriptor, and handing that index directly to archive.Export (with no platform option) caused the exporter to write the index blob into index.json as a manifest entry with the application/vnd.oci.image.index.v1+json media type, which registries reject. The fix resolves the index to its child manifest descriptors and exports those. A new test verifies the resulting archive's index.json references only manifests, and go.work.sum is updated with new dependency checksums.
Changes:
- Guard
image.Imagewith a nil check before dereferencingPlatforminctrd_save.go. - Add
manifestDescriptorsinbackend_archive.goto expand an index descriptor into its child manifests and export each viaarchive.WithManifest. - Add
TestSaveTarballIndexReferencesManifestsvalidating archiveindex.jsoncontents, plusgo.work.sumchecksum updates.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| image-spec/ctrd_save.go | Adds a nil check before dereferencing image.Image.Platform, preventing a panic. |
| image-spec/backend_archive.go | Resolves the index descriptor to child manifest descriptors before export to avoid emitting an index-typed entry in index.json. |
| image-spec/backend_test.go | Adds a test asserting exported index.json references only manifest-typed, well-formed manifest blobs. |
| go.work.sum | Auto-generated dependency checksum additions/removals. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Cezar Craciunoiu <cezar@unikraft.io>
a7f888c to
6719e20
Compare
No description provided.