diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-08-11 15:00:57 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-11 15:00:57 -0400 |
commit | 1deb4d1d70efb6d62f4fe5e735c94523f930b6d7 (patch) | |
tree | 394020b1a48f76cd283e450d6952cf08a4f53dde /pkg/api/handlers/compat/images_build.go | |
parent | 9a9ad853cb6781460829cb139cecbf9aff37896d (diff) | |
parent | 3f2cab86433859a1facf1996ad68dac23c9899b9 (diff) | |
download | podman-1deb4d1d70efb6d62f4fe5e735c94523f930b6d7.tar.gz podman-1deb4d1d70efb6d62f4fe5e735c94523f930b6d7.tar.bz2 podman-1deb4d1d70efb6d62f4fe5e735c94523f930b6d7.zip |
Merge pull request #7289 from vrothberg/v2-backports
V2 backports
Diffstat (limited to 'pkg/api/handlers/compat/images_build.go')
-rw-r--r-- | pkg/api/handlers/compat/images_build.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go index 8ac5b80c1..3d9efe61e 100644 --- a/pkg/api/handlers/compat/images_build.go +++ b/pkg/api/handlers/compat/images_build.go @@ -20,6 +20,7 @@ import ( "github.com/containers/libpod/v2/pkg/api/handlers/utils" "github.com/containers/storage/pkg/archive" "github.com/gorilla/schema" + "github.com/sirupsen/logrus" ) func BuildImage(w http.ResponseWriter, r *http.Request) { @@ -33,7 +34,13 @@ func BuildImage(w http.ResponseWriter, r *http.Request) { } if hdr, found := r.Header["Content-Type"]; found && len(hdr) > 0 { - if hdr[0] != "application/x-tar" { + contentType := hdr[0] + switch contentType { + case "application/tar": + logrus.Warnf("tar file content type is %s, should use \"application/x-tar\" content type", contentType) + case "application/x-tar": + break + default: utils.BadRequest(w, "Content-Type", hdr[0], fmt.Errorf("Content-Type: %s is not supported. Should be \"application/x-tar\"", hdr[0])) return |