Routing: Fix regexp syntax support in UserMatcher (#3900)

pull/3816/head^2
vnxme 2 months ago committed by GitHub
parent af7232d545
commit 5164a82185
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -202,7 +202,7 @@ func NewUserMatcher(users []string) *UserMatcher {
for _, user := range users { for _, user := range users {
if len(user) > 0 { if len(user) > 0 {
if len(user) > 7 && strings.HasPrefix(user, "regexp:") { if len(user) > 7 && strings.HasPrefix(user, "regexp:") {
if re, err := regexp.Compile(user[7:]); err != nil { if re, err := regexp.Compile(user[7:]); err == nil {
patternsCopy = append(patternsCopy, re) patternsCopy = append(patternsCopy, re)
} }
// Items of users slice with an invalid regexp syntax are ignored. // Items of users slice with an invalid regexp syntax are ignored.

Loading…
Cancel
Save