You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling web.Ctx.PostedFiles or webutil.PostedFiles(web.Ctx.Request) returns no files if web.Ctx.Param("param") is called beforehand with a missing parameter.
What you expected to happen:
PostedFiles should return the files from the request even if web.Ctx.Param is called with a missing parameter
How to reproduce it (as minimally and precisely as possible):
app := web.New(web.OptBindAddr(":8080"), web.OptLog(logger.All()))
app.POST("/file", func(r *web.Ctx) web.Result {
r.Param("non-existent")
files, err := webutil.PostedFiles(r.Request)
if err != nil {
return web.Text.BadRequest(err)
}
fmt.Println("num files", len(files))
return web.Text.OK()
})```
**Anything else we need to know?**:
This happens because the request gets consumed by the `r.Param` searching for all of the possible parameters
**Environment**:
- go-sdk version: master
- go version (e.g `go version`): go1.11.4 darwin/amd64
- OS (e.g: `cat /etc/os-release`): macOS 10.13.4
- Others:
The text was updated successfully, but these errors were encountered:
What happened:
Calling
web.Ctx.PostedFiles
orwebutil.PostedFiles(web.Ctx.Request)
returns no files ifweb.Ctx.Param("param")
is called beforehand with a missing parameter.What you expected to happen:
PostedFiles
should return the files from the request even ifweb.Ctx.Param
is called with a missing parameterHow to reproduce it (as minimally and precisely as possible):
The text was updated successfully, but these errors were encountered: