diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-03-29 20:36:07 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-29 20:36:07 +0000 |
commit | f24fabba13df6d442b120cb88fa57287ab85e2de (patch) | |
tree | 109299ef9cd051e08380119b41288f970443ed2a /pkg/api/handlers/compat/containers_prune.go | |
parent | c8af1747320bb9506ab4ea80892f0dae81c03a95 (diff) | |
parent | 1386f90467e9111533742b40f91018f908efea81 (diff) | |
download | podman-f24fabba13df6d442b120cb88fa57287ab85e2de.tar.gz podman-f24fabba13df6d442b120cb88fa57287ab85e2de.tar.bz2 podman-f24fabba13df6d442b120cb88fa57287ab85e2de.zip |
Merge pull request #9868 from mheon/310_backports
Final backports for v3.1.0
Diffstat (limited to 'pkg/api/handlers/compat/containers_prune.go')
-rw-r--r-- | pkg/api/handlers/compat/containers_prune.go | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/pkg/api/handlers/compat/containers_prune.go b/pkg/api/handlers/compat/containers_prune.go index dc4d53af6..e37929d27 100644 --- a/pkg/api/handlers/compat/containers_prune.go +++ b/pkg/api/handlers/compat/containers_prune.go @@ -9,23 +9,20 @@ import ( "github.com/containers/podman/v3/pkg/api/handlers/utils" "github.com/containers/podman/v3/pkg/domain/entities/reports" "github.com/containers/podman/v3/pkg/domain/filters" - "github.com/gorilla/schema" + "github.com/containers/podman/v3/pkg/util" "github.com/pkg/errors" ) func PruneContainers(w http.ResponseWriter, r *http.Request) { runtime := r.Context().Value("runtime").(*libpod.Runtime) - decoder := r.Context().Value("decoder").(*schema.Decoder) - - query := struct { - Filters map[string][]string `schema:"filters"` - }{} - if err := decoder.Decode(&query, r.URL.Query()); err != nil { - utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String())) + filtersMap, err := util.PrepareFilters(r) + if err != nil { + utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String())) return } - filterFuncs := make([]libpod.ContainerFilter, 0, len(query.Filters)) - for k, v := range query.Filters { + + filterFuncs := make([]libpod.ContainerFilter, 0, len(*filtersMap)) + for k, v := range *filtersMap { generatedFunc, err := filters.GenerateContainerFilterFuncs(k, v, runtime) if err != nil { utils.InternalServerError(w, err) |