aboutsummaryrefslogtreecommitdiff
path: root/federationapi/routing/threepid.go
diff options
context:
space:
mode:
Diffstat (limited to 'federationapi/routing/threepid.go')
-rw-r--r--federationapi/routing/threepid.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/federationapi/routing/threepid.go b/federationapi/routing/threepid.go
index 360802de..42ba8bfe 100644
--- a/federationapi/routing/threepid.go
+++ b/federationapi/routing/threepid.go
@@ -140,7 +140,14 @@ func ExchangeThirdPartyInvite(
}
}
- userID, err := rsAPI.QueryUserIDForSender(httpReq.Context(), roomID, spec.SenderID(proto.SenderID))
+ validRoomID, err := spec.NewRoomID(roomID)
+ if err != nil {
+ return util.JSONResponse{
+ Code: http.StatusBadRequest,
+ JSON: spec.BadJSON("Invalid room ID"),
+ }
+ }
+ userID, err := rsAPI.QueryUserIDForSender(httpReq.Context(), *validRoomID, spec.SenderID(proto.SenderID))
if err != nil || userID == nil {
return util.JSONResponse{
Code: http.StatusBadRequest,
@@ -150,7 +157,7 @@ func ExchangeThirdPartyInvite(
senderDomain := userID.Domain()
// Check that the state key is correct.
- targetUserID, err := rsAPI.QueryUserIDForSender(httpReq.Context(), roomID, spec.SenderID(*proto.StateKey))
+ targetUserID, err := rsAPI.QueryUserIDForSender(httpReq.Context(), *validRoomID, spec.SenderID(*proto.StateKey))
if err != nil || targetUserID == nil {
return util.JSONResponse{
Code: http.StatusBadRequest,