Skip to content

Commit 84b8aaf

Browse files
author
lukesolo
authored
Fix panic in FormFile if file not found (#1515)
1 parent 91b853a commit 84b8aaf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

context.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,11 @@ func (c *context) FormParams() (url.Values, error) {
360360

361361
func (c *context) FormFile(name string) (*multipart.FileHeader, error) {
362362
f, fh, err := c.request.FormFile(name)
363+
if err != nil {
364+
return nil, err
365+
}
363366
defer f.Close()
364-
return fh, err
367+
return fh, nil
365368
}
366369

367370
func (c *context) MultipartForm() (*multipart.Form, error) {

0 commit comments

Comments
 (0)