diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-01-21 10:07:27 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-21 10:07:27 -0500 |
commit | e3ea996919295213eacc41d01fdc4018cbc5edf6 (patch) | |
tree | 0c040f834e0c5453e61bd4e32105593c6bc14bf7 | |
parent | 6e171585027e5dfcf519cf4bdc9a281248cfe0c3 (diff) | |
parent | 653da8fe8f42d96a8ed117f8936f1187dd7288e8 (diff) | |
download | podman-e3ea996919295213eacc41d01fdc4018cbc5edf6.tar.gz podman-e3ea996919295213eacc41d01fdc4018cbc5edf6.tar.bz2 podman-e3ea996919295213eacc41d01fdc4018cbc5edf6.zip |
Merge pull request #12951 from rhatdan/commit
Fix #2 for compat commit handling of --changes
-rw-r--r-- | pkg/api/handlers/compat/images.go | 18 | ||||
-rw-r--r-- | test/apiv2/20-containers.at | 2 |
2 files changed, 10 insertions, 10 deletions
diff --git a/pkg/api/handlers/compat/images.go b/pkg/api/handlers/compat/images.go index 401a7ec1b..acb2172a2 100644 --- a/pkg/api/handlers/compat/images.go +++ b/pkg/api/handlers/compat/images.go @@ -97,13 +97,13 @@ func CommitContainer(w http.ResponseWriter, r *http.Request) { runtime := r.Context().Value(api.RuntimeKey).(*libpod.Runtime) query := struct { - Author string `schema:"author"` - Changes string `schema:"changes"` - Comment string `schema:"comment"` - Container string `schema:"container"` - Pause bool `schema:"pause"` - Repo string `schema:"repo"` - Tag string `schema:"tag"` + Author string `schema:"author"` + Changes []string `schema:"changes"` + Comment string `schema:"comment"` + Container string `schema:"container"` + Pause bool `schema:"pause"` + Repo string `schema:"repo"` + Tag string `schema:"tag"` // fromSrc string # fromSrc is currently unused }{ Tag: "latest", @@ -138,8 +138,8 @@ func CommitContainer(w http.ResponseWriter, r *http.Request) { options.Message = query.Comment options.Author = query.Author options.Pause = query.Pause - if query.Changes != "" { - options.Changes = strings.Split(query.Changes, ",") + for _, change := range query.Changes { + options.Changes = append(options.Changes, strings.Split(change, "\n")...) } ctr, err := runtime.LookupContainer(query.Container) if err != nil { diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at index 45c040fbc..cc5eda88e 100644 --- a/test/apiv2/20-containers.at +++ b/test/apiv2/20-containers.at @@ -434,7 +434,7 @@ cid=$(jq -r '.Id' <<<"$output") t POST "commit?container=nonesuch" 404 cparam="repo=newrepo&tag=v3&comment=abcd&author=eric" -cparam="$cparam&format=docker&changes=CMD=/bin/bar,EXPOSE=9090" +cparam="$cparam&format=docker&changes=CMD%20/bin/bar%0aEXPOSE%209090" t POST "commit?container=${cid:0:12}&$cparam" 201 \ .Id~[0-9a-f]\\{64\\} iid=$(jq -r '.Id' <<<"$output") |