From c5cfee4eb5f9130ac75653912e501e6e7e888241 Mon Sep 17 00:00:00 2001 From: Piotr Kozimor Date: Tue, 19 Jul 2022 11:03:22 +0200 Subject: [PATCH] Log malformed sync token --- syncapi/types/types.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/syncapi/types/types.go b/syncapi/types/types.go index 159fa08b6..eaf7ab381 100644 --- a/syncapi/types/types.go +++ b/syncapi/types/types.go @@ -23,6 +23,7 @@ import ( "github.com/matrix-org/dendrite/roomserver/api" "github.com/matrix-org/gomatrixserverlib" + "github.com/sirupsen/logrus" "github.com/tidwall/gjson" ) @@ -281,9 +282,11 @@ func NewTopologyTokenFromString(tok string) (token TopologyToken, err error) { func NewStreamTokenFromString(tok string) (token StreamingToken, err error) { if len(tok) < 1 { err = ErrMalformedSyncToken + logrus.WithField("token", tok).Info("invalid stream token: bad length") return } if tok[0] != SyncTokenTypeStream[0] { + logrus.WithField("token", tok).Info("invalid stream token: not starting from s") err = ErrMalformedSyncToken return } @@ -299,6 +302,7 @@ func NewStreamTokenFromString(tok string) (token StreamingToken, err error) { var pos int pos, err = strconv.Atoi(p) if err != nil { + logrus.WithField("token", tok).Info("invalid stream token: strconv") err = ErrMalformedSyncToken return }