From 5fc328b0a64286d2537ba0dbc05796542029c179 Mon Sep 17 00:00:00 2001 From: TP-O Date: Fri, 7 Apr 2023 16:22:47 +0700 Subject: [PATCH 1/2] fix image filter list Signed-off-by: TP-O --- pkg/api/handlers/compat/images.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/api/handlers/compat/images.go b/pkg/api/handlers/compat/images.go index 34f721a882..a563ff494e 100644 --- a/pkg/api/handlers/compat/images.go +++ b/pkg/api/handlers/compat/images.go @@ -11,7 +11,6 @@ import ( "github.com/containers/buildah" "github.com/containers/common/libimage" "github.com/containers/common/pkg/config" - "github.com/containers/common/pkg/filters" "github.com/containers/image/v5/manifest" "github.com/containers/image/v5/types" "github.com/containers/podman/v4/libpod" @@ -21,6 +20,7 @@ import ( "github.com/containers/podman/v4/pkg/auth" "github.com/containers/podman/v4/pkg/domain/entities" "github.com/containers/podman/v4/pkg/domain/infra/abi" + "github.com/containers/podman/v4/pkg/util" "github.com/containers/storage" "github.com/docker/docker/pkg/jsonmessage" "github.com/gorilla/schema" @@ -431,7 +431,7 @@ func GetImages(w http.ResponseWriter, r *http.Request) { return } - filterList, err := filters.FiltersFromRequest(r) + filterList, err := util.FiltersFromRequest(r) if err != nil { utils.Error(w, http.StatusInternalServerError, err) return From 449faa28b0517ec7d6f2cbffadc9c203b719a563 Mon Sep 17 00:00:00 2001 From: TP-O Date: Fri, 7 Apr 2023 19:19:42 +0700 Subject: [PATCH 2/2] add test Signed-off-by: TP-O --- test/apiv2/10-images.at | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/apiv2/10-images.at b/test/apiv2/10-images.at index 733a56f448..180f562211 100644 --- a/test/apiv2/10-images.at +++ b/test/apiv2/10-images.at @@ -124,7 +124,7 @@ from alpine RUN >file1 EOF -podman image build -t test:test --label xyz -<file2 EOF @@ -136,11 +136,15 @@ t GET images/json?filters='{"dangling":["true"]}' 200 length=0 #label filter check in libpod and compat t GET images/json?filters='{"label":["xyz"]}' 200 length=1 t GET libpod/images/json?filters='{"label":["xyz"]}' 200 length=1 +t GET images/json?filters='{"label":["xyz", "abc"]}' 200 length=1 +t GET libpod/images/json?filters='{"label":["xyz", "abc"]}' 200 length=1 t DELETE libpod/images/test:test 200 t GET images/json?filters='{"label":["xyz"]}' 200 length=0 t GET libpod/images/json?filters='{"label":["xyz"]}' 200 length=0 +t GET images/json?filters='{"label":["xyz", "abc"]}' 200 length=0 +t GET libpod/images/json?filters='{"label":["xyz", "abc"]}' 200 length=0 # to be used in prune until filter tests