From 3a5e9a0f284eef0fcb94a22035f9ffd2eb65eedf Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Wed, 13 Apr 2022 16:41:22 +0100 Subject: [PATCH] Use default sync filter if specified filter is not found (should fix #2350) (#2351) --- syncapi/sync/request.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/syncapi/sync/request.go b/syncapi/sync/request.go index 09a62e3d..f04f172d 100644 --- a/syncapi/sync/request.go +++ b/syncapi/sync/request.go @@ -15,6 +15,7 @@ package sync import ( + "database/sql" "encoding/json" "fmt" "net/http" @@ -60,10 +61,10 @@ func newSyncRequest(req *http.Request, device userapi.Device, syncDB storage.Dat util.GetLogger(req.Context()).WithError(err).Error("gomatrixserverlib.SplitID failed") return nil, fmt.Errorf("gomatrixserverlib.SplitID: %w", err) } - if f, err := syncDB.GetFilter(req.Context(), localpart, filterQuery); err != nil { + if f, err := syncDB.GetFilter(req.Context(), localpart, filterQuery); err != nil && err != sql.ErrNoRows { util.GetLogger(req.Context()).WithError(err).Error("syncDB.GetFilter failed") return nil, fmt.Errorf("syncDB.GetFilter: %w", err) - } else { + } else if f != nil { filter = *f } }