From 2c543ac03444452e42e9285bfa39906ba46404fc Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 15 Nov 2021 15:29:39 +0000 Subject: [PATCH] Error if no servers available to join via --- federationsender/internal/perform.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/federationsender/internal/perform.go b/federationsender/internal/perform.go index ce21d0ed..210ca529 100644 --- a/federationsender/internal/perform.go +++ b/federationsender/internal/perform.go @@ -83,6 +83,18 @@ func (r *FederationSenderInternalAPI) PerformJoin( } request.ServerNames = uniqueList + // If there are no servers to join via then, well, don't bother. + if len(request.ServerNames) == 0 { + response.LastError = &gomatrix.HTTPError{ + Code: 400, + Message: `{ + "errcode": "M_MISSING_PARAM", + "error": "No servers were supplied in the request." + }`, // TODO: Why do none of our error types play nicely with each other? + } + return + } + // Try each server that we were provided until we land on one that // successfully completes the make-join send-join dance. var lastErr error