diff options
author | Tulir Asokan <tulir@maunium.net> | 2018-05-02 22:30:43 +0300 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2018-05-02 22:30:57 +0300 |
commit | aec3b8d204dd8b4f9308f536e9b5eefcf966f86e (patch) | |
tree | e149182b3b085f55e2e9fe2388164dc5a38f68a3 /matrix/pushrules/condition.go | |
parent | 85cbd64c5e78c5b8aad46c96afbd67505987dec9 (diff) |
Add tests for PushRule.Match and fork glob to make it compatible with the spec
Diffstat (limited to 'matrix/pushrules/condition.go')
-rw-r--r-- | matrix/pushrules/condition.go | 7 |
1 files changed, 5 insertions, 2 deletions
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": |