summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorMatej Vasek <mvasek@redhat.com>2021-05-06 19:36:36 +0200
committerMatej Vasek <mvasek@redhat.com>2021-05-06 19:36:36 +0200
commit9da542a78bd025b1025c019ca27e1e9779323cc6 (patch)
tree56cb70e94540a2e6fcd61ac0e7ecc5dca996c110 /pkg
parentc58feddb7bcd7f59a72e3dab3413f99e99296cce (diff)
downloadpodman-9da542a78bd025b1025c019ca27e1e9779323cc6.tar.gz
podman-9da542a78bd025b1025c019ca27e1e9779323cc6.tar.bz2
podman-9da542a78bd025b1025c019ca27e1e9779323cc6.zip
fix pre review request
Signed-off-by: Matej Vasek <mvasek@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/handlers/compat/images.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/pkg/api/handlers/compat/images.go b/pkg/api/handlers/compat/images.go
index 0f7e0ccf5..4b7a2a71c 100644
--- a/pkg/api/handlers/compat/images.go
+++ b/pkg/api/handlers/compat/images.go
@@ -443,7 +443,7 @@ func ExportImages(w http.ResponseWriter, r *http.Request) {
runtime := r.Context().Value("runtime").(*libpod.Runtime)
query := struct {
- Names string `schema:"names"`
+ Names []string `schema:"names"`
}{
// This is where you can override the golang default value for one of fields
}
@@ -451,8 +451,16 @@ func ExportImages(w http.ResponseWriter, r *http.Request) {
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
return
}
- images := make([]string, 0)
- images = append(images, strings.Split(query.Names, ",")...)
+ if len(query.Names) <= 0 {
+ utils.Error(w, "Something went wrong.", http.StatusBadRequest, fmt.Errorf("no images to download"))
+ return
+ }
+ if len(query.Names) > 1 {
+ utils.Error(w, "Something went wrong.", http.StatusNotImplemented, fmt.Errorf("getting multiple image is not supported yet"))
+ return
+ }
+
+ images := query.Names
tmpfile, err := ioutil.TempFile("", "api.tar")
if err != nil {
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "unable to create tempfile"))