From 70debce5146a36c0d123cd4db4d309f9b56288d5 Mon Sep 17 00:00:00 2001 From: Till Faelligen Date: Tue, 15 Mar 2022 15:49:46 +0100 Subject: [PATCH] Ensure we return a non-empty list --- federationapi/routing/query.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/federationapi/routing/query.go b/federationapi/routing/query.go index 47d3b2df9..d73891946 100644 --- a/federationapi/routing/query.go +++ b/federationapi/routing/query.go @@ -70,7 +70,9 @@ func RoomAliasToID( util.GetLogger(httpReq.Context()).WithError(err).Error("senderAPI.QueryJoinedHostServerNamesInRoom failed") return jsonerror.InternalServerError() } - + if !serverQueryReq.ExcludeSelf && len(serverQueryRes.ServerNames) == 0 { + serverQueryRes.ServerNames = []gomatrixserverlib.ServerName{domain} + } resp = gomatrixserverlib.RespDirectory{ RoomID: queryRes.RoomID, Servers: serverQueryRes.ServerNames,