[IMP] attachment_s3: Consider bin_size context key

When bin_size context key is set, read operations on attachments
are supposed to return the size of the attachment and not its content
This commit is contained in:
Akim Juillerat committed 2020-03-18 12:51:48 +01:00
1 parent 20a8493a63
commit bd3be08203
1 file changed
+2
+2
View File
@@ -122,6 +122,8 @@ class IrAttachment(models.Model):
bucket.meta.client.head_object(
Bucket=bucket.name, Key=key
)
if bin_size:
return bucket.Object(key).content_length
res = io.BytesIO()
bucket.download_fileobj(key, res)
res.seek(0)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.