diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-09-01 13:01:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-01 17:01:08 +0000 |
commit | c586d6803a2adebcdd486be2d9eac1f62fd7d4ab (patch) | |
tree | f53c45fc1078710ed044e8848772efafb3a3e42b /synapse/handlers | |
parent | Consider the `origin_server_ts` of the `m.space.child` event when ordering ro... (diff) | |
download | synapse-c586d6803a2adebcdd486be2d9eac1f62fd7d4ab.tar.xz |
Ignore rooms with unknown room versions in the spaces summary. (#10727)
This avoids breaking the entire endpoint if a room with an unsupported room version is encountered.
Diffstat (limited to 'synapse/handlers')
-rw-r--r-- | synapse/handlers/room_summary.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/synapse/handlers/room_summary.py b/synapse/handlers/room_summary.py index d1b6f3253e..4bc9c73e6e 100644 --- a/synapse/handlers/room_summary.py +++ b/synapse/handlers/room_summary.py @@ -28,7 +28,14 @@ from synapse.api.constants import ( Membership, RoomTypes, ) -from synapse.api.errors import AuthError, Codes, NotFoundError, StoreError, SynapseError +from synapse.api.errors import ( + AuthError, + Codes, + NotFoundError, + StoreError, + SynapseError, + UnsupportedRoomVersionError, +) from synapse.events import EventBase from synapse.events.utils import format_event_for_client_v2 from synapse.types import JsonDict @@ -814,7 +821,12 @@ class RoomSummaryHandler: logger.info("room %s is unknown, omitting from summary", room_id) return False - room_version = await self._store.get_room_version(room_id) + try: + room_version = await self._store.get_room_version(room_id) + except UnsupportedRoomVersionError: + # If a room with an unsupported room version is encountered, ignore + # it to avoid breaking the entire summary response. + return False # Include the room if it has join rules of public or knock. join_rules_event_id = state_ids.get((EventTypes.JoinRules, "")) |