diff options
author | devonh <devon.dmytro@gmail.com> | 2023-09-15 14:39:06 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-15 14:39:06 +0000 |
commit | 8245b24100b0afaa046bb3fe52f0994f906c8ab1 (patch) | |
tree | f8d65fd4c27e208e5829f5ca0f66d79c639fabdb /federationapi/routing/leave.go | |
parent | 058081e68e4e23400645c6206cedddba8a31507e (diff) |
Update gmsl to use new validated RoomID on PDUs (#3200)
GMSL returns a `spec.RoomID` when calling `PDU.RoomID()`
Diffstat (limited to 'federationapi/routing/leave.go')
-rw-r--r-- | federationapi/routing/leave.go | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/federationapi/routing/leave.go b/federationapi/routing/leave.go index f28c8211..7c86ba69 100644 --- a/federationapi/routing/leave.go +++ b/federationapi/routing/leave.go @@ -211,7 +211,7 @@ func SendLeave( } // Check that the room ID is correct. - if event.RoomID() != roomID { + if event.RoomID().String() != roomID { return util.JSONResponse{ Code: http.StatusBadRequest, JSON: spec.BadJSON("The room ID in the request path must match the room ID in the leave event JSON"), @@ -242,14 +242,7 @@ func SendLeave( // Check that the sender belongs to the server that is sending us // the request. By this point we've already asserted that the sender // and the state key are equal so we don't need to check both. - validRoomID, err := spec.NewRoomID(event.RoomID()) - if err != nil { - return util.JSONResponse{ - Code: http.StatusBadRequest, - JSON: spec.BadJSON("Room ID is invalid."), - } - } - sender, err := rsAPI.QueryUserIDForSender(httpReq.Context(), *validRoomID, event.SenderID()) + sender, err := rsAPI.QueryUserIDForSender(httpReq.Context(), event.RoomID(), event.SenderID()) if err != nil { return util.JSONResponse{ Code: http.StatusForbidden, |