mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
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>
This commit is contained in:
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user