mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 11:47:23 +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:
parent
403a64bcc6
commit
58f0814530
1 changed files with 8 additions and 1 deletions
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue