From aec3b8d204dd8b4f9308f536e9b5eefcf966f86e Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 2 May 2018 22:30:43 +0300 Subject: Add tests for PushRule.Match and fork glob to make it compatible with the spec --- matrix/pushrules/condition.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'matrix/pushrules/condition.go') diff --git a/matrix/pushrules/condition.go b/matrix/pushrules/condition.go index 4d17695..6607323 100644 --- a/matrix/pushrules/condition.go +++ b/matrix/pushrules/condition.go @@ -21,7 +21,7 @@ import ( "strconv" "strings" - "github.com/zyedidia/glob" + "maunium.net/go/gomuks/lib/glob" "maunium.net/go/gomatrix" "maunium.net/go/gomuks/matrix/rooms" ) @@ -82,7 +82,10 @@ func (cond *PushCondition) matchValue(room Room, event *gomatrix.Event) bool { key = key[0:index] } - pattern, _ := glob.Compile(cond.Pattern) + pattern, err := glob.Compile(cond.Pattern) + if err != nil { + return false + } switch key { case "type": -- cgit v1.2.3