Skip to content

Commit

Permalink
Merge pull request containerd#8890 from AkihiroSuda/follow-up-8744
Browse files Browse the repository at this point in the history
remotes: FetchByDigest: propagate media type from config to desc
  • Loading branch information
mxpv authored Jan 25, 2024
2 parents d5f7e54 + e9f2bba commit 8d417cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/ctr/commands/content/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,11 @@ var (
if err != nil {
return err
}
rc, _, err := fetcherByDigest.FetchByDigest(ctx, dgst, remotes.WithMediaType(context.String("media-type")))
rc, desc, err := fetcherByDigest.FetchByDigest(ctx, dgst, remotes.WithMediaType(context.String("media-type")))
if err != nil {
return err
}
log.G(ctx).Debugf("desc=%+v", desc)
_, err = io.Copy(os.Stdout, rc)
rc.Close()
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions core/remotes/docker/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ func (r dockerFetcher) FetchByDigest(ctx context.Context, dgst digest.Digest, op
Digest: dgst,
Size: sz,
}
if config.Mediatype != "" {
desc.MediaType = config.Mediatype
}
return seeker, desc, nil
}

Expand Down

0 comments on commit 8d417cb

Please sign in to comment.