Page MenuHomePhabricator

Hovercards: Regex for title bolding in popup doesn't escape title
Closed, ResolvedPublic

Description

Author: wiki.nihiltres

Description:
"C" in "ANSI C" is bolded, but not "C*"

In ext.popups.renderer.article.js, the article.getProcessedHtml function bolds instances of the article title. However, it doesn't escape the title text provided to the regex it uses to search, and some titles contain regex syntax, causing odd results.


Version: unspecified
Severity: major

Attached:

Screen_shot_2014-06-05_at_1.09.34_PM.png (278×335 px, 32 KB)

Details

Reference
bz66203

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:17 AM
bzimport added a project: Page-Previews.
bzimport set Reference to bz66203.

Change 137862 had a related patch set uploaded by Prtksxna:
renderer.article: Escape RegExp syntax from the article's title

https://gerrit.wikimedia.org/r/137862

This issue blocks popups from appearing in some cases, giving for example:

Uncaught SyntaxError: Invalid regular expression: /(^|\s)(FurryDC++)(\s|$)/: Nothing to repeat

The included patch appears to resolve this issue.

Change 137862 merged by jenkins-bot:
renderer.article: Escape RegExp syntax from the article's title

https://gerrit.wikimedia.org/r/137862

Fixed, patch will be deployed within two weeks per the roadmap ([[mw:MediaWiki 1.24/Roadmap]]), unless it's backported earlier.