mirror of
https://github.com/labstack/echo.git
synced 2024-12-24 20:14:31 +02:00
Fix panic in FormFile if file not found (#1515)
This commit is contained in:
parent
91b853a6f2
commit
84b8aaf24f
@ -360,8 +360,11 @@ func (c *context) FormParams() (url.Values, error) {
|
|||||||
|
|
||||||
func (c *context) FormFile(name string) (*multipart.FileHeader, error) {
|
func (c *context) FormFile(name string) (*multipart.FileHeader, error) {
|
||||||
f, fh, err := c.request.FormFile(name)
|
f, fh, err := c.request.FormFile(name)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
return fh, err
|
return fh, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *context) MultipartForm() (*multipart.Form, error) {
|
func (c *context) MultipartForm() (*multipart.Form, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user