forked from TrueCloudLab/frostfs-http-gw
Add cleanup multipart form on defer
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
This commit is contained in:
parent
462de45e12
commit
0346db462b
1 changed files with 6 additions and 0 deletions
|
@ -64,6 +64,12 @@ func (a *app) upload(c *fasthttp.RequestCtx) {
|
||||||
|
|
||||||
log.Debug("close temporary file", zap.Error(tmp.Close()))
|
log.Debug("close temporary file", zap.Error(tmp.Close()))
|
||||||
log.Debug("remove temporary file", zap.Error(os.RemoveAll(tmpName)))
|
log.Debug("remove temporary file", zap.Error(os.RemoveAll(tmpName)))
|
||||||
|
|
||||||
|
if form == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Debug("cleanup multipart form", zap.Error(form.RemoveAll()))
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if form, err = c.MultipartForm(); err != nil {
|
if form, err = c.MultipartForm(); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue