From 54e74f8bde4ff02d6cb9acb3de11a0186af96d43 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 14 Feb 2022 19:28:00 +0000 Subject: [PATCH] Fix M_WRONG_ROOM_KEYS_VERSION error not including `current_version` field (#11988) Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- changelog.d/11988.bugfix | 1 + synapse/api/errors.py | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 changelog.d/11988.bugfix diff --git a/changelog.d/11988.bugfix b/changelog.d/11988.bugfix new file mode 100644 index 000000000..ced10d0c8 --- /dev/null +++ b/changelog.d/11988.bugfix @@ -0,0 +1 @@ +Fix a long-standing bug where `M_WRONG_ROOM_KEYS_VERSION` errors would not include the specced `current_version` field. diff --git a/synapse/api/errors.py b/synapse/api/errors.py index 85302163d..e92db29f6 100644 --- a/synapse/api/errors.py +++ b/synapse/api/errors.py @@ -406,6 +406,9 @@ class RoomKeysVersionError(SynapseError): super().__init__(403, "Wrong room_keys version", Codes.WRONG_ROOM_KEYS_VERSION) self.current_version = current_version + def error_dict(self) -> "JsonDict": + return cs_error(self.msg, self.errcode, current_version=self.current_version) + class UnsupportedRoomVersionError(SynapseError): """The client's request to create a room used a room version that the server does