Ensure signature map exists (fixes #2393) (#2397)

This commit is contained in:
Neil Alexander 2022-04-28 11:34:19 +01:00 committed by GitHub
parent 74259f296f
commit 2ff75b7c80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -319,6 +319,9 @@ func (a *KeyInternalAPI) QueryKeys(ctx context.Context, req *api.QueryKeysReques
// JSON, add the signatures and marshal it again, for some reason? // JSON, add the signatures and marshal it again, for some reason?
for targetUserID, masterKey := range res.MasterKeys { for targetUserID, masterKey := range res.MasterKeys {
if masterKey.Signatures == nil {
masterKey.Signatures = map[string]map[gomatrixserverlib.KeyID]gomatrixserverlib.Base64Bytes{}
}
for targetKeyID := range masterKey.Keys { for targetKeyID := range masterKey.Keys {
sigMap, err := a.DB.CrossSigningSigsForTarget(ctx, req.UserID, targetUserID, targetKeyID) sigMap, err := a.DB.CrossSigningSigsForTarget(ctx, req.UserID, targetUserID, targetKeyID)
if err != nil { if err != nil {