Storage/S3: Change tmp file name

This commit is contained in:
Natalia Juszka 2018-04-27 15:13:11 +02:00 committed by Adrian Moennich
parent 72f4ddec05
commit e7790f8dde
2 changed files with 3 additions and 4 deletions

View File

@ -104,7 +104,7 @@ class S3Storage(Storage):
@contextmanager
def get_local_path(self, file_id):
with NamedTemporaryFile(suffix='indico.tmp', dir=config.TEMP_DIR) as tmpfile:
with NamedTemporaryFile(suffix='indico.s3', dir=config.TEMP_DIR) as tmpfile:
self._copy_file(self.open(file_id), tmpfile)
tmpfile.flush()
yield tmpfile.name
@ -135,7 +135,7 @@ class S3Storage(Storage):
def send_file(self, file_id, content_type, filename, inline=True):
try:
content_disp = ('inline' if inline else 'attachment')
content_disp = 'inline' if inline else 'attachment'
h = Headers()
h.add('Content-Disposition', content_disp, filename=filename)
url = self.client.generate_presigned_url('get_object',

View File

@ -46,8 +46,7 @@ def mock_bucket_created(self, name):
pass
class MockConfig:
class MockConfig(object):
def __init__(self):
self.STORAGE_BACKENDS = {'s3': None}