Error when text entered in category select box contains invalid regex syntax


(Jens Maier) #1

There’s a bug in category-group.js.es6:

https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/components/category-group.js.es6#L16

Either, the userinput in term should be escaped, or errors due to an invalid regex should be reported to the user.

To reproduce, go to your profile settings and type an asterisk in any of the category selection boxes, then check browser console and/or /logs for an “Uncaught SyntaxError: Invalid regular expression: /*/: Nothing to repeat”.


(Sam Saffron) #2

Sure… just escape it, seems like the original intention


(Jens Maier) #3

https://github.com/discourse/discourse/pull/3411


(Jeff Atwood) #4