From a2687783d447183a7ab0c97023b87e9731cc7fe9 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sun, 26 Dec 2021 15:21:08 +0100 Subject: prefix imageId with sha256: in containers list test for compat API ImageId Signed-off-by: Oliver Thallmair --- pkg/api/handlers/compat/containers.go | 2 +- test/apiv2/20-containers.at | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go index 4f101ce84..5a06722ec 100644 --- a/pkg/api/handlers/compat/containers.go +++ b/pkg/api/handlers/compat/containers.go @@ -360,7 +360,7 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error ID: l.ID(), Names: []string{fmt.Sprintf("/%s", l.Name())}, Image: imageName, - ImageID: imageID, + ImageID: "sha256:" + imageID, Command: strings.Join(l.Command(), " "), Created: l.CreatedTime().Unix(), Ports: ports, diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at index e931ceebe..5a02ca3cb 100644 --- a/test/apiv2/20-containers.at +++ b/test/apiv2/20-containers.at @@ -46,6 +46,10 @@ t GET /containers/json?all=true 200 \ .[0].Image=$IMAGE \ $network_expect +# compat API imageid with sha256: prefix +t GET containers/json?limit=1 200 \ + .[0].ImageID~sha256:[0-9a-f]\\{64\\} + # Make sure `limit` works. t GET libpod/containers/json?limit=1 200 \ length=1 \ -- cgit v1.2.3-54-g00ecf