Commits

Anonymous committed d174fea

Close file before deleting it.

  • Participants
  • Parent commits e19ebdd

Comments (0)

Files changed (1)

File gp/fileupload/storage.py

         if length > self.max_size:
             return exc.HTTPServerError('File is too big')
 
-        bsize = 1024
+        bsize = 4096
         if length < bsize:
             blocks = [length]
         else:
         else:
             rfile.write(dfile.read())
 
+        # remove temp file
+        dfile.close()
+        os.remove(dpath)
+
         # update content-length from new input
         req.content_length = rfile.tell()
 
         # restore input
         req.environ['wsgi.input'] = input
 
-        # remove temp file
-        os.remove(dpath)
-
         return resp
 
 def make_app(application, global_conf, tempdir=None,