Skip to content

Commit

Permalink
Docker compat API - /images/search returns wrong structure (#7857)
Browse files Browse the repository at this point in the history
Signed-off-by: Milivoje Legenovic <[email protected]>
  • Loading branch information
mlegenovic committed Dec 17, 2020
1 parent 915ae6d commit 29358e3
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion pkg/api/handlers/compat/images_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)
}

0 comments on commit 29358e3

Please sign in to comment.