From ef06b214b2c1c82700a4f8bb6be66e8a1cd1de1a Mon Sep 17 00:00:00 2001 From: Adrian Moennich Date: Mon, 5 Nov 2018 11:15:29 +0100 Subject: [PATCH] Storage/S3: Fix open() method --- storage_s3/indico_storage_s3/plugin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storage_s3/indico_storage_s3/plugin.py b/storage_s3/indico_storage_s3/plugin.py index 03497c1..e8cd046 100644 --- a/storage_s3/indico_storage_s3/plugin.py +++ b/storage_s3/indico_storage_s3/plugin.py @@ -106,8 +106,9 @@ class S3Storage(Storage): raise StorageError('A bucket secret is required when using dynamic bucket names') def open(self, file_id): + bucket, id_ = file_id.split('//', 1) try: - s3_object = self.client.get_object(Bucket=self._get_current_bucket_name(), Key=file_id)['Body'] + s3_object = self.client.get_object(Bucket=bucket, Key=id_)['Body'] return BytesIO(s3_object.read()) except Exception as e: raise StorageError('Could not open "{}": {}'.format(file_id, e)), None, sys.exc_info()[2]