Skip to content

Commit

Permalink
Merge pull request #34 from acoshift/ctx/close-file
Browse files Browse the repository at this point in the history
ctx: close file if file empty
  • Loading branch information
acoshift committed Jun 4, 2018
2 parents 2f218d3 + b5cd46e commit 2f5ab4c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions request.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func (ctx *appContext) FormFileNotEmpty(key string) (multipart.File, *multipart.
return nil, nil, err
}
if header.Size == 0 {
file.Close()
return nil, nil, http.ErrMissingFile
}
return file, header, err
Expand Down

0 comments on commit 2f5ab4c

Please sign in to comment.