summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorMatej Vasek <mvasek@redhat.com>2021-02-08 19:17:38 +0100
committerMatej Vasek <mvasek@redhat.com>2021-02-09 18:20:15 +0100
commit721a1e104e388a788ab5760019fa91bcf1a5d762 (patch)
tree96b084b932fe554a671482685665c529a51a4d76 /pkg
parent2bf13219f587d769400f26aeaed05930c34ce3d7 (diff)
downloadpodman-721a1e104e388a788ab5760019fa91bcf1a5d762.tar.gz
podman-721a1e104e388a788ab5760019fa91bcf1a5d762.tar.bz2
podman-721a1e104e388a788ab5760019fa91bcf1a5d762.zip
Fix Docker APIv2 push endpoint
Docker doesn't have the destination parameter as libpod does, the "image name" path parameter is supposed to be the destination. Signed-off-by: Matej Vasek <mvasek@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/handlers/compat/images_push.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/pkg/api/handlers/compat/images_push.go b/pkg/api/handlers/compat/images_push.go
index c352ac6cd..34b53f34e 100644
--- a/pkg/api/handlers/compat/images_push.go
+++ b/pkg/api/handlers/compat/images_push.go
@@ -1,7 +1,6 @@
package compat
import (
- "context"
"net/http"
"strings"
@@ -76,7 +75,15 @@ func PushImage(w http.ResponseWriter, r *http.Request) {
if _, found := r.URL.Query()["tlsVerify"]; found {
options.SkipTLSVerify = types.NewOptionalBool(!query.TLSVerify)
}
- if err := imageEngine.Push(context.Background(), imageName, query.Destination, options); err != nil {
+
+ var destination string
+ if _, found := r.URL.Query()["destination"]; found {
+ destination = query.Destination
+ } else {
+ destination = imageName
+ }
+
+ if err := imageEngine.Push(r.Context(), imageName, destination, options); err != nil {
if errors.Cause(err) != storage.ErrImageUnknown {
utils.ImageNotFound(w, imageName, errors.Wrapf(err, "failed to find image %s", imageName))
return