You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-07 10:46:24 +03:00
EventIndex: Handle invalid m.room.redaction events correctly.
Clients might send invalid redaction events, such events will not have a valid redacts field containing the event id of the associated event that was redacted. Skip such events instead of ending up looping over the checkpoint forever.
This commit is contained in:
@@ -507,7 +507,14 @@ export default class EventIndex extends EventEmitter {
|
||||
try {
|
||||
for (let i = 0; i < redactionEvents.length; i++) {
|
||||
const ev = redactionEvents[i];
|
||||
await indexManager.deleteEvent(ev.getAssociatedId());
|
||||
const eventId = ev.getAssociatedId();
|
||||
|
||||
if (eventId) {
|
||||
await indexManager.deleteEvent(eventId);
|
||||
} else {
|
||||
console.log("EventIndex: Redaction event doesn't contain a",
|
||||
"valid associated event id", ev);
|
||||
}
|
||||
}
|
||||
|
||||
const eventsAlreadyAdded = await indexManager.addHistoricEvents(
|
||||
|
||||
Reference in New Issue
Block a user