@@ -123,6 +123,19 @@ async def on_POST(
123
123
errcode = Codes .INVALID_PARAM ,
124
124
)
125
125
126
+ # Make sure that the prev_event_ids exist and aren't outliers - ie, they are
127
+ # regular parts of the room DAG where we know the state.
128
+ non_outlier_prev_events = await self .store .have_events_in_timeline (
129
+ prev_event_ids_from_query
130
+ )
131
+ for prev_event_id in prev_event_ids_from_query :
132
+ if prev_event_id not in non_outlier_prev_events :
133
+ raise SynapseError (
134
+ HTTPStatus .BAD_REQUEST ,
135
+ "prev_event %s does not exist, or is an outlier" % (prev_event_id ,),
136
+ errcode = Codes .INVALID_PARAM ,
137
+ )
138
+
126
139
# For the event we are inserting next to (`prev_event_ids_from_query`),
127
140
# find the most recent state events that allowed that message to be
128
141
# sent. We will use that as a base to auth our historical messages
@@ -131,14 +144,6 @@ async def on_POST(
131
144
prev_event_ids_from_query
132
145
)
133
146
134
- if not state_event_ids :
135
- raise SynapseError (
136
- HTTPStatus .BAD_REQUEST ,
137
- "No auth events found for given prev_event query parameter. The prev_event=%s probably does not exist."
138
- % prev_event_ids_from_query ,
139
- errcode = Codes .INVALID_PARAM ,
140
- )
141
-
142
147
state_event_ids_at_start = []
143
148
# Create and persist all of the state events that float off on their own
144
149
# before the batch. These will most likely be all of the invite/member
0 commit comments