From fdd804c5d9c9aa2a222802cd89bc5419a25cc6c9 Mon Sep 17 00:00:00 2001 From: Igor Noskov Date: Wed, 4 May 2016 18:03:58 +0600 Subject: [PATCH] clean only if error is nil --- server/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/server.go b/server/server.go index 30385e7..e355e0c 100644 --- a/server/server.go +++ b/server/server.go @@ -115,7 +115,6 @@ func (s *Server) uploadFile(uploadFile io.Reader, fileName string, thumbs []*upl } upload, err := uploadedfile.NewUploadedFile(fileName, tmpFile, thumbs) - defer upload.Clean() if err != nil { return ServerResponse{ @@ -123,6 +122,7 @@ func (s *Server) uploadFile(uploadFile io.Reader, fileName string, thumbs []*upl Status: http.StatusInternalServerError, } } + defer upload.Clean() processor, err := s.processorStrategy(s.Config, upload) if err != nil {