summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-03-04 11:09:25 -0500
committerGitHub <noreply@github.com>2021-03-04 11:09:25 -0500
commit7a92de4bacdff145a871371d5a306bd349e83374 (patch)
tree359bcacb5843281732d4e26bad9935427efd5215 /pkg
parent7b76340864a7a5ba9e1008a017402d2b4a14032e (diff)
parent2c8c5393a492929b75dd459889a1c1ef28e2b393 (diff)
downloadpodman-7a92de4bacdff145a871371d5a306bd349e83374.tar.gz
podman-7a92de4bacdff145a871371d5a306bd349e83374.tar.bz2
podman-7a92de4bacdff145a871371d5a306bd349e83374.zip
Merge pull request #9550 from baude/issue9517
Support label type dict on compat build
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/handlers/compat/images_build.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go
index 009fcf7e8..e06f93b89 100644
--- a/pkg/api/handlers/compat/images_build.go
+++ b/pkg/api/handlers/compat/images_build.go
@@ -222,9 +222,17 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
// convert label formats
var labels = []string{}
if _, found := r.URL.Query()["labels"]; found {
- if err := json.Unmarshal([]byte(query.Labels), &labels); err != nil {
- utils.BadRequest(w, "labels", query.Labels, err)
- return
+ makeLabels := make(map[string]string)
+ err := json.Unmarshal([]byte(query.Labels), &makeLabels)
+ if err == nil {
+ for k, v := range makeLabels {
+ labels = append(labels, k+"="+v)
+ }
+ } else {
+ if err := json.Unmarshal([]byte(query.Labels), &labels); err != nil {
+ utils.BadRequest(w, "labels", query.Labels, err)
+ return
+ }
}
}
jobs := 1