diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-04-13 16:41:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-13 16:41:22 +0100 |
commit | 3a5e9a0f284eef0fcb94a22035f9ffd2eb65eedf (patch) | |
tree | 3da57a3b948061779629dc8f6467aba88d8c8149 | |
parent | 1140f39993f1d4fb80952bf853bb05df0b42ca20 (diff) |
Use default sync filter if specified filter is not found (should fix #2350) (#2351)
-rw-r--r-- | syncapi/sync/request.go | 5 |
1 files 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 } } |