Skip to content

Commit 9bcd800

Browse files
committed
Fix an issue where we would send an invalid /user/keys/query request
1 parent c70b213 commit 9bcd800

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

fclient/federationclient.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,13 @@ func (ac *federationClient) ClaimKeys(ctx context.Context, origin, s spec.Server
633633
func (ac *federationClient) QueryKeys(ctx context.Context, origin, s spec.ServerName, keys map[string][]string) (res RespQueryKeys, err error) {
634634
path := federationPathPrefixV1 + "/user/keys/query"
635635
req := NewFederationRequest("POST", origin, s, path)
636-
if err = req.SetContent(map[string]interface{}{
636+
// Ensure that the keys map has empty slices for any nil values.
637+
for k, v := range keys {
638+
if v == nil {
639+
keys[k] = []string{}
640+
}
641+
}
642+
if err = req.SetContent(map[string]map[string][]string{
637643
"device_keys": keys,
638644
}); err != nil {
639645
return

0 commit comments

Comments
 (0)