19597: Comment explicit ParseForm usage.
authorTom Clegg <tom@curii.com>
Mon, 16 Jan 2023 22:26:41 +0000 (17:26 -0500)
committerTom Clegg <tom@curii.com>
Mon, 16 Jan 2023 22:26:41 +0000 (17:26 -0500)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

lib/controller/router/request.go

index c0a2f23cc12c0ed2ddaf2566cb5bc6eff494fbf1..97efe31726abe69d378a9742ac84042064d627b0 100644 (file)
@@ -61,6 +61,12 @@ 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))