diff --git a/pantalaimon/daemon.py b/pantalaimon/daemon.py index b0c9cef..2ed122d 100755 --- a/pantalaimon/daemon.py +++ b/pantalaimon/daemon.py @@ -909,14 +909,14 @@ class ProxyDaemon: msgtype = request.match_info["event_type"] + content = "" + try: + content = await request.json() + except (JSONDecodeError, ContentTypeError): + return self._not_json + # The room isn't encrypted just forward the message. if not encrypt: - content = "" - try: - content = await request.json() - except (JSONDecodeError, ContentTypeError): - return self._not_json - content_msgtype = content["msgtype"] if content_msgtype in ["m.image", "m.video", "m.audio", "m.file"] or msgtype == "m.room.avatar": try: