mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-24 08:47:40 +00:00
[12.0][IMP] attachment_azure: don't get blob content if we only need its size
This commit is contained in:
@@ -150,7 +150,10 @@ class IrAttachment(models.Model):
|
|||||||
key = fname.replace("azure://", "", 1).lower()
|
key = fname.replace("azure://", "", 1).lower()
|
||||||
try:
|
try:
|
||||||
blob_client = container_client.get_blob_client(key)
|
blob_client = container_client.get_blob_client(key)
|
||||||
read = base64.b64encode(blob_client.download_blob().readall())
|
if bin_size:
|
||||||
|
return blob_client.get_blob_properties()['size']
|
||||||
|
else:
|
||||||
|
read = base64.b64encode(blob_client.download_blob().readall())
|
||||||
except HttpResponseError:
|
except HttpResponseError:
|
||||||
read = ""
|
read = ""
|
||||||
_logger.info("Attachment '%s' missing on object storage", fname)
|
_logger.info("Attachment '%s' missing on object storage", fname)
|
||||||
|
|||||||
Reference in New Issue
Block a user