mirror of
https://github.com/containers/podman.git
synced 2025-06-23 10:38:20 +08:00
@ -409,14 +409,20 @@ func GetImages(w http.ResponseWriter, r *http.Request) {
|
|||||||
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "Failed get images"))
|
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "Failed get images"))
|
||||||
return
|
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)
|
is, err := handlers.ImageToImageSummary(img)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "Failed transform image summaries"))
|
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "Failed transform image summaries"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
summaries[j] = is
|
summaries = append(summaries, is)
|
||||||
}
|
}
|
||||||
utils.WriteResponse(w, http.StatusOK, summaries)
|
utils.WriteResponse(w, http.StatusOK, summaries)
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,13 @@ t GET libpod/images/json 200 \
|
|||||||
.[0].Id~[0-9a-f]\\{64\\}
|
.[0].Id~[0-9a-f]\\{64\\}
|
||||||
iid=$(jq -r '.[0].Id' <<<"$output")
|
iid=$(jq -r '.[0].Id' <<<"$output")
|
||||||
|
|
||||||
|
# Create an empty manifest and make sure it is not listed
|
||||||
|
# in the compat endpoint.
|
||||||
|
t GET images/json 200 length=1
|
||||||
|
podman manifest create foo
|
||||||
|
t GET images/json 200 length=1
|
||||||
|
t GET libpod/images/json 200 length=2
|
||||||
|
|
||||||
t GET libpod/images/$iid/exists 204
|
t GET libpod/images/$iid/exists 204
|
||||||
t GET libpod/images/$PODMAN_TEST_IMAGE_NAME/exists 204
|
t GET libpod/images/$PODMAN_TEST_IMAGE_NAME/exists 204
|
||||||
t GET libpod/images/${iid}abcdef/exists 404 \
|
t GET libpod/images/${iid}abcdef/exists 404 \
|
||||||
|
Reference in New Issue
Block a user