From 024ddda123bcc1e042451f1990973291200fa090 Mon Sep 17 00:00:00 2001 From: Jhon Honce Date: Mon, 17 Feb 2020 10:55:42 -0700 Subject: Update mux rules to allow slashes in image names %2F escaping is also supported. Return better response on bad search terms Fixes #5229 Signed-off-by: Jhon Honce --- pkg/api/handlers/utils/images.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pkg/api/handlers/utils/images.go') diff --git a/pkg/api/handlers/utils/images.go b/pkg/api/handlers/utils/images.go index d0dfbf3ab..f68a71561 100644 --- a/pkg/api/handlers/utils/images.go +++ b/pkg/api/handlers/utils/images.go @@ -31,12 +31,16 @@ func GetImages(w http.ResponseWriter, r *http.Request) ([]*image.Image, error) { if _, found := mux.Vars(r)["digests"]; found && query.Digests { UnSupportedParameter("digests") } + if len(query.Filters) > 0 { for k, v := range query.Filters { for _, val := range v { filters = append(filters, fmt.Sprintf("%s=%s", k, val)) } } + return runtime.ImageRuntime().GetImagesWithFilters(filters) + } else { + return runtime.ImageRuntime().GetImages() } - return runtime.ImageRuntime().GetImagesWithFilters(filters) + } -- cgit v1.2.3-54-g00ecf