mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-23 18:04:34 +00:00
[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:
committed by
Guewen Baconnier
co-authored by
Guewen Baconnier
parent
fd335d89be
commit
c89bfc83e0
@@ -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