From 2b26133711c3f87e614b13c66799f9a7ff164f0c Mon Sep 17 00:00:00 2001 From: RogerSelwyn Date: Mon, 2 May 2022 13:08:49 +0100 Subject: [PATCH] Fix photo embedding --- custom_components/o365/manifest.json | 2 +- custom_components/o365/notify.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/custom_components/o365/manifest.json b/custom_components/o365/manifest.json index 983c528..2cb0b0d 100644 --- a/custom_components/o365/manifest.json +++ b/custom_components/o365/manifest.json @@ -14,6 +14,6 @@ "O365==2.0.18.1", "BeautifulSoup4>=4.10.0" ], - "version": "v3.0.0", + "version": "v3.0.1", "iot_class": "cloud_polling" } \ No newline at end of file diff --git a/custom_components/o365/notify.py b/custom_components/o365/notify.py index d8decb9..ece2470 100644 --- a/custom_components/o365/notify.py +++ b/custom_components/o365/notify.py @@ -120,7 +120,9 @@ def _build_photo_content(self, photos, new_message_attachments): photos = [photos] photos_content = "" + i = 0 for photo in photos: + i += 1 if photo.startswith("http"): photos_content += f'
' else: @@ -128,8 +130,8 @@ def _build_photo_content(self, photos, new_message_attachments): new_message_attachments.add(photo) att = new_message_attachments[-1] att.is_inline = True - att.content_id = "1" - photos_content += f'
' + att.content_id = str(i) + photos_content += f'
' return photos_content