summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-12-17 13:53:55 +0000
committerGitHub <noreply@github.com>2020-12-17 13:53:55 +0000
commitd29101340414da5649ba0452d184fa7d17ccc8c1 (patch)
treed02b677e3fa283fb7676980d6f2805f4cdb69643
parentc38ae47a1adf3235d8b01d724e7327e608dd8078 (diff)
parent29358e3e0968c2b72712d11e0a412ebf5ea78417 (diff)
downloadpodman-d29101340414da5649ba0452d184fa7d17ccc8c1.tar.gz
podman-d29101340414da5649ba0452d184fa7d17ccc8c1.tar.bz2
podman-d29101340414da5649ba0452d184fa7d17ccc8c1.zip
Merge pull request #8758 from mlegenovic/master
Docker compat API - /images/search returns wrong structure (#7857)
-rw-r--r--pkg/api/handlers/compat/images_search.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/pkg/api/handlers/compat/images_search.go b/pkg/api/handlers/compat/images_search.go
index b3ceae3ee..6808cdad5 100644
--- a/pkg/api/handlers/compat/images_search.go
+++ b/pkg/api/handlers/compat/images_search.go
@@ -8,6 +8,7 @@ import (
"github.com/containers/podman/v2/libpod/image"
"github.com/containers/podman/v2/pkg/api/handlers/utils"
"github.com/containers/podman/v2/pkg/auth"
+ "github.com/docker/docker/api/types/registry"
"github.com/gorilla/schema"
"github.com/pkg/errors"
)
@@ -77,5 +78,18 @@ func SearchImages(w http.ResponseWriter, r *http.Request) {
utils.BadRequest(w, "term", query.Term, err)
return
}
- utils.WriteResponse(w, http.StatusOK, results)
+
+ compatResults := make([]registry.SearchResult, 0, len(results))
+ for _, result := range results {
+ compatResult := registry.SearchResult{
+ Name: result.Name,
+ Description: result.Description,
+ StarCount: result.Stars,
+ IsAutomated: result.Automated == "[OK]",
+ IsOfficial: result.Official == "[OK]",
+ }
+ compatResults = append(compatResults, compatResult)
+ }
+
+ utils.WriteResponse(w, http.StatusOK, compatResults)
}