diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2021-12-02 13:25:54 +0100 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2021-12-06 15:47:04 -0500 |
commit | d9527638845d6eb756885e858a7c27670b8ca687 (patch) | |
tree | 4912a70cf10b942b6e5698cb89b6936555e44166 /pkg/api | |
parent | 658d133390120105cf673cd7dfe5d3436be29d38 (diff) | |
download | podman-d9527638845d6eb756885e858a7c27670b8ca687.tar.gz podman-d9527638845d6eb756885e858a7c27670b8ca687.tar.bz2 podman-d9527638845d6eb756885e858a7c27670b8ca687.zip |
compat: images/json
Do not list manifest lists. Docker doesn't either.
Fixes: #12453
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg/api')
-rw-r--r-- | pkg/api/handlers/compat/images.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/pkg/api/handlers/compat/images.go b/pkg/api/handlers/compat/images.go index 0b7ba8bee..5c73cb0bd 100644 --- a/pkg/api/handlers/compat/images.go +++ b/pkg/api/handlers/compat/images.go @@ -393,14 +393,20 @@ func GetImages(w http.ResponseWriter, r *http.Request) { utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "Failed get images")) return } - var summaries = make([]*entities.ImageSummary, len(images)) - for j, img := range images { + + summaries := make([]*entities.ImageSummary, 0, len(images)) + for _, img := range images { + // If the image is a manifest list, extract as much as we can. + if isML, _ := img.IsManifestList(r.Context()); isML { + continue + } + is, err := handlers.ImageToImageSummary(img) if err != nil { utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "Failed transform image summaries")) return } - summaries[j] = is + summaries = append(summaries, is) } utils.WriteResponse(w, http.StatusOK, summaries) } |