From 0f9f702f564e5391a6f5a05f25a065eddd677339 Mon Sep 17 00:00:00 2001 From: MmeQuignon Date: Fri, 17 Mar 2023 15:35:54 +0100 Subject: [PATCH] azure_attachment: handle no container client --- attachment_azure/models/ir_attachment.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/attachment_azure/models/ir_attachment.py b/attachment_azure/models/ir_attachment.py index 2538817..2a2f4df 100644 --- a/attachment_azure/models/ir_attachment.py +++ b/attachment_azure/models/ir_attachment.py @@ -173,6 +173,8 @@ class IrAttachment(models.Model): location = self.env.context.get("storage_location") or self._storage() if location == "azure": container_client = self._get_azure_container() + if not container_client: + return "" filename = "azure://%s/%s" % (container_client.container_name, key) with io.BytesIO() as file: blob_client = container_client.get_blob_client(key.lower())