Commits

Jannis Leidel committed e51055a

Close the Gzip file again and reset the file's current position to the beginning.

Comments (0)

Files changed (1)

storages/backends/s3boto.py

         """Gzip a given string content."""
         zbuf = StringIO()
         zfile = GzipFile(mode='wb', compresslevel=6, fileobj=zbuf)
-        zfile.write(content.read())
-        zfile.close()
+        try:
+            zfile.write(content.read())
+        finally:
+            zfile.close()
         content.file = zbuf
+        content.seek(0)
         return content
 
     def _open(self, name, mode='rb'):