From b90a18a62a35f8b92a85325b1ce3654c628080b9 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Tue, 20 Sep 2022 13:19:28 +0100 Subject: [PATCH] Fix #45: ensure we don't send null when we mean [] --- sync2/poller.go | 2 ++ sync3/extensions/account_data.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sync2/poller.go b/sync2/poller.go index 6592cb0..9c5facf 100644 --- a/sync2/poller.go +++ b/sync2/poller.go @@ -339,6 +339,8 @@ func (p *Poller) FallbackKeyTypes() []string { func (p *Poller) DeviceListChanges() (changed, left []string) { p.e2eeMu.Lock() defer p.e2eeMu.Unlock() + changed = make([]string, 0) + left = make([]string, 0) for userID, state := range p.deviceListChanges { switch state { case "changed": diff --git a/sync3/extensions/account_data.go b/sync3/extensions/account_data.go index ae4bea3..5c22619 100644 --- a/sync3/extensions/account_data.go +++ b/sync3/extensions/account_data.go @@ -19,8 +19,8 @@ func (r AccountDataRequest) ApplyDelta(next *AccountDataRequest) *AccountDataReq // Server response type AccountDataResponse struct { - Global []json.RawMessage `json:"global"` - Rooms map[string][]json.RawMessage `json:"rooms"` + Global []json.RawMessage `json:"global,omitempty"` + Rooms map[string][]json.RawMessage `json:"rooms,omitempty"` } func (r *AccountDataResponse) HasData(isInitial bool) bool {