Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix exception when using MSC3030 to look for remote federated events before room creation #13197

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/13197.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix exception when using experimental [MSC3030](https://github.com/matrix-org/matrix-spec-proposals/pull/3030) `/timestamp_to_event` endpoint to look for remote federated imported events before room creation.
3 changes: 2 additions & 1 deletion synapse/handlers/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -1375,6 +1375,7 @@ async def get_event_for_timestamp(
# the timestamp given and the event we were able to find locally
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review @squahtx 🐰

is_event_next_to_backward_gap = False
is_event_next_to_forward_gap = False
local_event = None
if local_event_id:
local_event = await self.store.get_event(
local_event_id, allow_none=False, allow_rejected=False
Expand Down Expand Up @@ -1461,7 +1462,7 @@ async def get_event_for_timestamp(
ex.args,
)

if not local_event_id:
if not local_event_id or not local_event:
squahtx marked this conversation as resolved.
Show resolved Hide resolved
raise SynapseError(
404,
"Unable to find event from %s in direction %s" % (timestamp, direction),
Expand Down