jenkins-bot has submitted this change and it was merged. Change subject: renderer.article: Escape RegExp syntax from the article's title ......................................................................
renderer.article: Escape RegExp syntax from the article's title Bug: 66203 Change-Id: Id9b523643e8540a717919fa5bb65a6d980722c0f --- M resources/ext.popups.renderer.article.js 1 file changed, 1 insertion(+), 0 deletions(-) Approvals: Bartosz Dziewoński: Looks good to me, approved jenkins-bot: Verified diff --git a/resources/ext.popups.renderer.article.js b/resources/ext.popups.renderer.article.js index 3f65740..74a5922 100644 --- a/resources/ext.popups.renderer.article.js +++ b/resources/ext.popups.renderer.article.js @@ -134,6 +134,7 @@ * @return {String} */ article.getProcessedHtml = function ( extract, title ) { + title = title.replace( /([.?*+^$[\]\\(){}|-])/g, '\\$1' ); // Escape RegExp elements var regExp = new RegExp( '(^|\\s)(' + title + ')(\\s|$)', 'ig' ); // Make title bold in the extract text extract = extract.replace( regExp, '$1<b>$2</b>$3' ); -- To view, visit https://gerrit.wikimedia.org/r/137862 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id9b523643e8540a717919fa5bb65a6d980722c0f Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Popups Gerrit-Branch: master Gerrit-Owner: Prtksxna <psax...@wikimedia.org> Gerrit-Reviewer: Bartosz Dziewoński <matma....@gmail.com> Gerrit-Reviewer: Spage <sp...@wikimedia.org> Gerrit-Reviewer: Yuvipanda <yuvipa...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits