azure_attachment: handle no container client

This commit is contained in:
MmeQuignon
2023-03-17 15:35:54 +01:00
parent 05d111f7c1
commit 0f9f702f56
+2
View File
@@ -173,6 +173,8 @@ class IrAttachment(models.Model):
location = self.env.context.get("storage_location") or self._storage() location = self.env.context.get("storage_location") or self._storage()
if location == "azure": if location == "azure":
container_client = self._get_azure_container() container_client = self._get_azure_container()
if not container_client:
return ""
filename = "azure://%s/%s" % (container_client.container_name, key) filename = "azure://%s/%s" % (container_client.container_name, key)
with io.BytesIO() as file: with io.BytesIO() as file:
blob_client = container_client.get_blob_client(key.lower()) blob_client = container_client.get_blob_client(key.lower())