mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 13:22:46 +00:00
Add pushrules tests (#3044)
partly takes care of https://github.com/matrix-org/dendrite/issues/2870 by making sure that rule IDs don't start with a dot. Co-authored-by: kegsay <kegan@matrix.org>
This commit is contained in:
parent
ca63b414da
commit
c45d8cd688
5 changed files with 430 additions and 68 deletions
|
@ -10,6 +10,10 @@ import (
|
|||
func ValidateRule(kind Kind, rule *Rule) []error {
|
||||
var errs []error
|
||||
|
||||
if len(rule.RuleID) > 0 && rule.RuleID[:1] == "." {
|
||||
errs = append(errs, fmt.Errorf("invalid rule ID: rule can not start with a dot"))
|
||||
}
|
||||
|
||||
if !validRuleIDRE.MatchString(rule.RuleID) {
|
||||
errs = append(errs, fmt.Errorf("invalid rule ID: %s", rule.RuleID))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue