From 1c30fd9c974d34e2760419464659b36237453d1c Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Thu, 5 Aug 2021 15:57:44 +0100 Subject: [PATCH] Don't skip devices that don't have signatures --- federationapi/routing/devices.go | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/federationapi/routing/devices.go b/federationapi/routing/devices.go index b88540bff..593551e6f 100644 --- a/federationapi/routing/devices.go +++ b/federationapi/routing/devices.go @@ -66,20 +66,16 @@ func GetUserDevices( Keys: key, } - targetUser, ok := sigRes.Signatures[dev.UserID] - if !ok { - continue - } - targetKey, ok := targetUser[gomatrixserverlib.KeyID(dev.DeviceID)] - if !ok { - continue - } - for sourceUserID, forSourceUser := range targetKey { - for sourceKeyID, sourceKey := range forSourceUser { - if _, ok := device.Keys.Signatures[sourceUserID]; !ok { - device.Keys.Signatures[sourceUserID] = map[gomatrixserverlib.KeyID]gomatrixserverlib.Base64Bytes{} + if targetUser, ok := sigRes.Signatures[dev.UserID]; ok { + if targetKey, ok := targetUser[gomatrixserverlib.KeyID(dev.DeviceID)]; !ok { + for sourceUserID, forSourceUser := range targetKey { + for sourceKeyID, sourceKey := range forSourceUser { + if _, ok := device.Keys.Signatures[sourceUserID]; !ok { + device.Keys.Signatures[sourceUserID] = map[gomatrixserverlib.KeyID]gomatrixserverlib.Base64Bytes{} + } + device.Keys.Signatures[sourceUserID][sourceKeyID] = sourceKey + } } - device.Keys.Signatures[sourceUserID][sourceKeyID] = sourceKey } }