diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-03-25 14:40:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-25 14:40:21 -0700 |
commit | 9e23e0b3e3b219cbdc42fac4f843d6d2ec97421b (patch) | |
tree | 6986b66d1aa4e37999ffd091900b9a487e87d202 /pkg/api/handlers/utils | |
parent | 8eb36320ca321ba514b5388cfdb11595e61a7d49 (diff) | |
parent | 429a655866ba6298935a2fb53cd6e1e8653bab4d (diff) | |
download | podman-9e23e0b3e3b219cbdc42fac4f843d6d2ec97421b.tar.gz podman-9e23e0b3e3b219cbdc42fac4f843d6d2ec97421b.tar.bz2 podman-9e23e0b3e3b219cbdc42fac4f843d6d2ec97421b.zip |
Merge pull request #9810 from jmguzik/fix-impages-filter-http-api
Fix filters list/prune in image http compat/libpod api endpoints
Diffstat (limited to 'pkg/api/handlers/utils')
-rw-r--r-- | pkg/api/handlers/utils/images.go | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/pkg/api/handlers/utils/images.go b/pkg/api/handlers/utils/images.go index 743629db8..da3c9e985 100644 --- a/pkg/api/handlers/utils/images.go +++ b/pkg/api/handlers/utils/images.go @@ -11,6 +11,7 @@ import ( "github.com/containers/image/v5/types" "github.com/containers/podman/v3/libpod" "github.com/containers/podman/v3/libpod/image" + "github.com/containers/podman/v3/pkg/util" "github.com/gorilla/schema" "github.com/pkg/errors" ) @@ -58,13 +59,17 @@ func GetImages(w http.ResponseWriter, r *http.Request) ([]*image.Image, error) { runtime := r.Context().Value("runtime").(*libpod.Runtime) query := struct { All bool - Filters map[string][]string `schema:"filters"` Digests bool Filter string // Docker 1.24 compatibility }{ // This is where you can override the golang default value for one of fields } + filterMap, err := util.PrepareFilters(r) + if err != nil { + return nil, err + } + if err := decoder.Decode(&query, r.URL.Query()); err != nil { return nil, err } @@ -72,12 +77,9 @@ func GetImages(w http.ResponseWriter, r *http.Request) ([]*image.Image, error) { if _, found := r.URL.Query()["digests"]; found && query.Digests { UnSupportedParameter("digests") } - var ( - images []*image.Image - err error - ) + var images []*image.Image - queryFilters := query.Filters + queryFilters := *filterMap if !IsLibpodRequest(r) && len(query.Filter) > 0 { // Docker 1.24 compatibility if queryFilters == nil { queryFilters = make(map[string][]string) |