[12.0][IMP] attachment_azure: don't get blob content if we only need its size

This commit is contained in:
Nils Hamerlinck
2021-09-07 11:02:26 +07:00
parent f39a896367
commit 079951dbd9
+3
View File
@@ -150,6 +150,9 @@ 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)
if bin_size:
return blob_client.get_blob_properties()['size']
else:
read = base64.b64encode(blob_client.download_blob().readall()) read = base64.b64encode(blob_client.download_blob().readall())
except HttpResponseError: except HttpResponseError:
read = "" read = ""