diff options
author | Jhon Honce <jhonce@redhat.com> | 2021-08-09 09:19:21 -0700 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2021-08-20 11:28:54 -0400 |
commit | 89818f72b740195215520c7765a686ca843e46a7 (patch) | |
tree | 3132b748e03fb0875893e8434c1750c2fce31708 /pkg | |
parent | 47b6a5acdc087de748377dacaaf43b4a557072f3 (diff) | |
download | podman-89818f72b740195215520c7765a686ca843e46a7.tar.gz podman-89818f72b740195215520c7765a686ca843e46a7.tar.bz2 podman-89818f72b740195215520c7765a686ca843e46a7.zip |
For compatibility, ignore Content-Type
Endpoint /build logs an info entry when a client uses the wrong
Content-Type for build payload. Given Content-Type is ignored and
assumed to be "application/x-tar".
Endpoint /libpod/build will fail unless "application/x-tar" or
"application/tar" is given for Content-Type. "application/tar" will
be logged as an info entry.
Fixes #11012
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/api/handlers/compat/images_build.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go index 08d1df4b8..0fcca1821 100644 --- a/pkg/api/handlers/compat/images_build.go +++ b/pkg/api/handlers/compat/images_build.go @@ -34,13 +34,16 @@ func BuildImage(w http.ResponseWriter, r *http.Request) { contentType := hdr[0] switch contentType { case "application/tar": - logrus.Warnf("tar file content type is %s, should use \"application/x-tar\" content type", contentType) + logrus.Infof("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 + if utils.IsLibpodRequest(r) { + utils.BadRequest(w, "Content-Type", hdr[0], + fmt.Errorf("Content-Type: %s is not supported. Should be \"application/x-tar\"", hdr[0])) + return + } + logrus.Infof("tar file content type is %s, should use \"application/x-tar\" content type", contentType) } } |