Storage/S3: Add md5 checksum

This commit is contained in:
Natalia Juszka 2018-03-26 11:55:15 +02:00 committed by Adrian Moennich
parent 4699f85234
commit 36f8ef06d2
2 changed files with 6 additions and 4 deletions

View File

@ -75,8 +75,10 @@ class S3Storage(Storage):
def save(self, name, content_type, filename, fileobj):
try:
self.client.upload_fileobj(fileobj, self.bucket, name)
return name, ''
fileobject = self._ensure_fileobj(fileobj)
self.client.upload_fileobj(fileobject, self.bucket, name)
checksum = self.client.head_object(Bucket=self.bucket, Key=name)['ETag'][1:-1]
return name, checksum
except Exception as e:
raise StorageError('Could not save "{}": {}'.format(name, e)), None, sys.exc_info()[2]

View File

@ -21,7 +21,7 @@ from setuptools import setup
setup(
name='indico-plugin-storage-s3',
version='1.0',
version='1.0-dev',
description='S3 storage backend for Indico',
url='https://github.com/indico/indico-plugins',
license='https://www.gnu.org/licenses/gpl-3.0.txt',
@ -32,7 +32,7 @@ setup(
platforms='any',
install_requires=[
'indico>=2.0',
'boto3>=1.6.5'
'boto3>=1.6.16,<2.0'
],
classifiers=[
'Environment :: Plugins',