Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix image filter in list images API #18097

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/api/handlers/compat/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion test/apiv2/10-images.at
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ from alpine
RUN >file1
EOF

podman image build -t test:test --label xyz -<<EOF
podman image build -t test:test --label xyz --label abc -<<EOF
from alpine
RUN >file2
EOF
Expand All @@ -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
Expand Down