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

Commit

Permalink
Handle outliers in /federation/v1/event
Browse files Browse the repository at this point in the history
  • Loading branch information
richvdh committed Mar 30, 2022
1 parent 0f1b943 commit 3dd43e5
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions synapse/handlers/federation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1029,19 +1029,24 @@ async def get_persisted_pdu(
event_id, allow_none=True, allow_rejected=True
)

if event:
in_room = await self._event_auth_handler.check_host_in_room(
event.room_id, origin
)
if not in_room:
raise AuthError(403, "Host not in room.")
if not event:
return None

events = await filter_events_for_server(self.storage, origin, [event])
event = events[0]
return event
else:
if event.internal_metadata.is_outlier():
# we can't tell if the requesting server can see this event, since
# we don't have the state at that point. Return a 404.
return None

in_room = await self._event_auth_handler.check_host_in_room(
event.room_id, origin
)
if not in_room:
raise AuthError(403, "Host not in room.")

events = await filter_events_for_server(self.storage, origin, [event])
event = events[0]
return event

async def on_get_missing_events(
self,
origin: str,
Expand Down

0 comments on commit 3dd43e5

Please sign in to comment.