mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-26 21:18:34 +08:00
Cooking any post raises `MiniRacer::RuntimeError: SyntaxError: Invalid regular expression: /+1/: Nothing to repeat` whenever the `emoji_deny_list` site setting contains a name with a regex metacharacter such as `+1` or `-1`. Every page that renders cooked content then 500s. The names are real Unicode emoji aliases admins must be able to deny, so validating them away is not an option. The deny-list block in `applyEmoji` used `content.match(emoji)` which coerces the raw emoji name into a regex via `new RegExp(...)`, and `+1` does not compile as a regex. This commit switches that block to literal-string `includes` and `replaceAll` against the `:name:` token. Deny-list semantics for plain names are unchanged: the denied emoji is still stripped from `content` before token generation, so no `<img class="emoji">` is rendered. |
||
|---|---|---|
| .. | ||
| features | ||
| engine.js | ||
| index.js | ||
| options.js | ||
| setup.js | ||