Ensure we return a non-empty list

This commit is contained in:
Till Faelligen 2022-03-15 15:49:46 +01:00
parent 69268fc48e
commit 70debce514

View file

@ -70,7 +70,9 @@ func RoomAliasToID(
util.GetLogger(httpReq.Context()).WithError(err).Error("senderAPI.QueryJoinedHostServerNamesInRoom failed") util.GetLogger(httpReq.Context()).WithError(err).Error("senderAPI.QueryJoinedHostServerNamesInRoom failed")
return jsonerror.InternalServerError() return jsonerror.InternalServerError()
} }
if !serverQueryReq.ExcludeSelf && len(serverQueryRes.ServerNames) == 0 {
serverQueryRes.ServerNames = []gomatrixserverlib.ServerName{domain}
}
resp = gomatrixserverlib.RespDirectory{ resp = gomatrixserverlib.RespDirectory{
RoomID: queryRes.RoomID, RoomID: queryRes.RoomID,
Servers: serverQueryRes.ServerNames, Servers: serverQueryRes.ServerNames,