diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go index 3005063a79..0557d52d4f 100644 --- a/pkg/api/handlers/compat/images_build.go +++ b/pkg/api/handlers/compat/images_build.go @@ -33,9 +33,21 @@ 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" { + validContentTypes := []string{ + "application/tar", + "application/x-tar", + "application/x-gtar", + } + + isValidContentType := false + for _, validContentType := range validContentTypes { + if validContentType == hdr[0] { + isValidContentType = true + } + } + if !isValidContentType { utils.BadRequest(w, "Content-Type", hdr[0], - fmt.Errorf("Content-Type: %s is not supported. Should be \"application/x-tar\"", hdr[0])) + fmt.Errorf("Content-Type: %s is not supported. Should be one of %s", hdr[0], validContentTypes)) return } } diff --git a/pkg/api/server/docs.go b/pkg/api/server/docs.go index 1aaf31117e..af7468f7aa 100644 --- a/pkg/api/server/docs.go +++ b/pkg/api/server/docs.go @@ -52,6 +52,8 @@ // // Consumes: // - application/json +// - application/tar // - application/x-tar +// - application/x-gtar // swagger:meta package server