1. David Larlet
  2. django-storages

Commits

pendletongp  committed ee9b972

identify the SpooledTemporaryFile on disk with a suffix. Use settings.FILE_UPLOAD_TEMP_DIR for placing the file.

  • Participants
  • Parent commits 16dee4f
  • Branches default

Comments (0)

Files changed (1)

File storages/backends/s3boto.py

View file
 
     def _get_file(self):
         if self._file is None:
-            self._file = SpooledTemporaryFile(max_size=self._storage.file_max_size)
+            kwargs = {
+                "max_size": self._storage.file_max_size,
+                "suffix": ".S3BotoStorageFile",
+                "dir": setting("FILE_UPLOAD_TEMP_DIR", None)
+            }
+            self._file = SpooledTemporaryFile(**kwargs)
             if 'r' in self._mode:
                 self._is_dirty = False
                 self.key.get_contents_to_file(self._file)