Error if no servers available to join via

This commit is contained in:
Neil Alexander 2021-11-15 15:29:39 +00:00
parent 0c3d2f0f64
commit 2c543ac034
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -83,6 +83,18 @@ func (r *FederationSenderInternalAPI) PerformJoin(
} }
request.ServerNames = uniqueList 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 // Try each server that we were provided until we land on one that
// successfully completes the make-join send-join dance. // successfully completes the make-join send-join dance.
var lastErr error var lastErr error