From bc3ceab03938b236aa5c387b72faf70f9f57f7fc Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 11 May 2019 20:12:34 +0300 Subject: [PATCH] Fix handling of null m.relates_to objects. Fixes #317 --- mautrix_telegram/formatter/from_matrix/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mautrix_telegram/formatter/from_matrix/__init__.py b/mautrix_telegram/formatter/from_matrix/__init__.py index f8a1119e..2adc76ac 100644 --- a/mautrix_telegram/formatter/from_matrix/__init__.py +++ b/mautrix_telegram/formatter/from_matrix/__init__.py @@ -88,7 +88,7 @@ def matrix_to_telegram(html: str) -> ParsedMessage: def matrix_reply_to_telegram(content: Dict[str, Any], tg_space: TelegramID, room_id: Optional[MatrixRoomID] = None) -> Optional[TelegramID]: try: - reply = content.get("m.relates_to", {}).get("m.in_reply_to", {}) + reply = (content.get("m.relates_to", None) or {}).get("m.in_reply_to", {}) if not reply: return None room_id = room_id or reply["room_id"]