X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/38104975556f7a0a59c1a21a97aa37cd0e178d69..db118cca358662e57a3dd0c1186dce1f0a62ca52:/lib/controller/router/request.go diff --git a/lib/controller/router/request.go b/lib/controller/router/request.go index eae9e0a8ce..97efe31726 100644 --- a/lib/controller/router/request.go +++ b/lib/controller/router/request.go @@ -61,9 +61,25 @@ func guessAndParse(k, v string) (interface{}, error) { // If the request has a parameter whose name is attrsKey (e.g., // "collection"), it is renamed to "attrs". func (rtr *router) loadRequestParams(req *http.Request, attrsKey string) (map[string]interface{}, error) { + // Here we call ParseForm and ParseMultipartForm explicitly + // (even though ParseMultipartForm calls ParseForm if + // necessary) to ensure we catch errors encountered in + // ParseForm. In the non-multipart-form case, + // ParseMultipartForm returns ErrNotMultipart and hides the + // ParseForm error. err := req.ParseForm() + if err == nil { + err = req.ParseMultipartForm(int64(rtr.config.MaxRequestSize)) + if err == http.ErrNotMultipart { + err = nil + } + } if err != nil { - return nil, httpError(http.StatusBadRequest, err) + if err.Error() == "http: request body too large" { + return nil, httpError(http.StatusRequestEntityTooLarge, err) + } else { + return nil, httpError(http.StatusBadRequest, err) + } } params := map[string]interface{}{} @@ -172,6 +188,7 @@ var boolParams = map[string]bool{ "bypass_federation": true, "recursive": true, "exclude_home_project": true, + "no_forward": true, } func stringToBool(s string) bool {