Skip to content

Commit

Permalink
fix(oci): Initialize the index's descriptor (#959)
Browse files Browse the repository at this point in the history
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Approved-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
  • Loading branch information
craciunoiuc committed Nov 1, 2023
2 parents 55dd31c + 294806e commit faff6eb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions oci/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ func NewIndexFromSpec(ctx context.Context, handle handler.Handler, spec *ocispec

index.index = spec

indexJson, err := json.Marshal(spec)
if err != nil {
return nil, fmt.Errorf("failed to marshal manifest: %w", err)
}

indexDesc := content.NewDescriptorFromBytes(
ocispec.MediaTypeImageIndex,
indexJson,
)

index.desc = &indexDesc

for _, desc := range spec.Manifests {
manifest, err := NewManifestFromDigest(ctx, handle, desc.Digest)
if err != nil {
Expand Down

0 comments on commit faff6eb

Please sign in to comment.