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

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”.

4 Likes

Sure… just escape it, seems like the original intention

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

4 Likes