From 4b6b61c4be6eebf34d0c203e8902f0a8e7d4c20a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 21 Apr 2020 12:04:02 +0200 Subject: [PATCH] pantalaimon: Modify the media events so they contain the decrypted URLs as well. This closes 43. --- pantalaimon/client.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pantalaimon/client.py b/pantalaimon/client.py index 78d00e5..f20b792 100644 --- a/pantalaimon/client.py +++ b/pantalaimon/client.py @@ -827,6 +827,17 @@ class PanClient(AsyncClient): ) ) + if isinstance(decrypted_event, RoomEncryptedMedia): + decrypted_event.source["content"]["url"] = decrypted_event.url + + if ( + "info" in decrypted_event.source + and "thumbnail_file" in decrypted_event.source["info"] + ): + decrypted_event.source["content"]["info"][ + "thumbnail_url" + ] = decrypted_event.source["thumbnail_file"].get("url") + event_dict.update(decrypted_event.source) event_dict["decrypted"] = True event_dict["verified"] = decrypted_event.verified