aboutsummaryrefslogtreecommitdiff
path: root/federationapi/internal/perform.go
diff options
context:
space:
mode:
Diffstat (limited to 'federationapi/internal/perform.go')
-rw-r--r--federationapi/internal/perform.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/federationapi/internal/perform.go b/federationapi/internal/perform.go
index 970a6465..9100c8f1 100644
--- a/federationapi/internal/perform.go
+++ b/federationapi/internal/perform.go
@@ -213,10 +213,14 @@ func (r *FederationInternalAPI) performJoinUsingServer(
// If the remote server returned an event in the "event" key of
// the send_join request then we should use that instead. It may
// contain signatures that we don't know about.
- if respSendJoin.Event != nil && isWellFormedMembershipEvent(
- respSendJoin.Event, roomID, userID, r.cfg.Matrix.ServerName,
- ) {
- event = respSendJoin.Event
+ if len(respSendJoin.Event) > 0 {
+ var remoteEvent *gomatrixserverlib.Event
+ remoteEvent, err = respSendJoin.Event.UntrustedEvent(respMakeJoin.RoomVersion)
+ if err == nil && isWellFormedMembershipEvent(
+ remoteEvent, roomID, userID, r.cfg.Matrix.ServerName,
+ ) {
+ event = remoteEvent
+ }
}
// Sanity-check the join response to ensure that it has a create