diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-11-15 15:05:23 +0000 |
---|---|---|
committer | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-11-15 15:05:23 +0000 |
commit | 6650712a1c0dec282b47b7ba14bc8c2e06a385d8 (patch) | |
tree | 12ca755c5c33d3489417f9355dda3f1b7983c779 /federationapi/routing/leave.go | |
parent | f4ee3977340c84d321767d347795b1dcd05ac459 (diff) |
Federation fixes for virtual hosting
Diffstat (limited to 'federationapi/routing/leave.go')
-rw-r--r-- | federationapi/routing/leave.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/federationapi/routing/leave.go b/federationapi/routing/leave.go index a67e4e28..f1e9f49b 100644 --- a/federationapi/routing/leave.go +++ b/federationapi/routing/leave.go @@ -13,6 +13,7 @@ package routing import ( + "fmt" "net/http" "time" @@ -60,8 +61,18 @@ func MakeLeave( return jsonerror.InternalServerError() } + identity, err := cfg.Matrix.SigningIdentityFor(request.Destination()) + if err != nil { + return util.JSONResponse{ + Code: http.StatusNotFound, + JSON: jsonerror.NotFound( + fmt.Sprintf("Server name %q does not exist", request.Destination()), + ), + } + } + var queryRes api.QueryLatestEventsAndStateResponse - event, err := eventutil.QueryAndBuildEvent(httpReq.Context(), &builder, cfg.Matrix, time.Now(), rsAPI, &queryRes) + event, err := eventutil.QueryAndBuildEvent(httpReq.Context(), &builder, cfg.Matrix, identity, time.Now(), rsAPI, &queryRes) if err == eventutil.ErrRoomNoExists { return util.JSONResponse{ Code: http.StatusNotFound, |