Update gmsl to use new validated RoomID on PDUs (#3200)

GMSL returns a `spec.RoomID` when calling `PDU.RoomID()`
This commit is contained in:
devonh 2023-09-15 14:39:06 +00:00 committed by GitHub
parent 058081e68e
commit 8245b24100
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
64 changed files with 241 additions and 413 deletions

View file

@ -513,14 +513,14 @@ func restrictedJoinRuleAllowedRooms(ctx context.Context, joinRuleEv *types.Heade
}
var jrContent gomatrixserverlib.JoinRuleContent
if err := json.Unmarshal(joinRuleEv.Content(), &jrContent); err != nil {
util.GetLogger(ctx).Warnf("failed to check join_rule on room %s: %s", joinRuleEv.RoomID(), err)
util.GetLogger(ctx).Warnf("failed to check join_rule on room %s: %s", joinRuleEv.RoomID().String(), err)
return nil
}
for _, allow := range jrContent.Allow {
if allow.Type == spec.MRoomMembership {
allowedRoomID, err := spec.NewRoomID(allow.RoomID)
if err != nil {
util.GetLogger(ctx).Warnf("invalid room ID '%s' found in join_rule on room %s: %s", allow.RoomID, joinRuleEv.RoomID(), err)
util.GetLogger(ctx).Warnf("invalid room ID '%s' found in join_rule on room %s: %s", allow.RoomID, joinRuleEv.RoomID().String(), err)
} else {
allows = append(allows, *allowedRoomID)
}

View file

@ -49,6 +49,7 @@ func (db *getEventDB) addFakeEvent(eventID string, authIDs []string) error {
}
builder := map[string]interface{}{
"event_id": eventID,
"room_id": "!room:a",
"auth_events": authEvents,
}