mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-29 12:42:46 +00:00
Detect types.MissingStateError
in CheckServerAllowedToSeeEvent
(#2667)
This will hopefully stop some 500 errors on `/event` where there is no state-before known.
This commit is contained in:
parent
95a509757a
commit
14fea600bb
3 changed files with 11 additions and 4 deletions
|
@ -254,8 +254,15 @@ func CheckServerAllowedToSeeEvent(
|
|||
return false, err
|
||||
}
|
||||
default:
|
||||
// Something else went wrong
|
||||
return false, err
|
||||
switch err.(type) {
|
||||
case types.MissingStateError:
|
||||
// If there's no state then we assume it's open visibility, as Synapse does:
|
||||
// https://github.com/matrix-org/synapse/blob/aec87a0f9369a3015b2a53469f88d1de274e8b71/synapse/visibility.py#L654-L655
|
||||
return true, nil
|
||||
default:
|
||||
// Something else went wrong
|
||||
return false, err
|
||||
}
|
||||
}
|
||||
return auth.IsServerAllowed(serverName, isServerInRoom, stateAtEvent), nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue