Arlolra has uploaded a new change for review. https://gerrit.wikimedia.org/r/308224
Change subject: Decode all char refs in text ...................................................................... Decode all char refs in text Change-Id: Ib74cd38907ed9de4d23003545c31abe11f63ad17 --- M lib/wt2html/tt/Sanitizer.js 1 file changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid refs/changes/24/308224/1 diff --git a/lib/wt2html/tt/Sanitizer.js b/lib/wt2html/tt/Sanitizer.js index 1e283d7..aacb41d 100644 --- a/lib/wt2html/tt/Sanitizer.js +++ b/lib/wt2html/tt/Sanitizer.js @@ -327,7 +327,7 @@ * Regular expression to match various types of character references in * Sanitizer::normalizeCharReferences and Sanitizer::decodeCharReferences */ - CHAR_REFS_RE: /&([A-Za-z0-9\x80-\xff]+);|&\#([0-9]+);|&\#[xX]([0-9A-Fa-f]+);|(&)/, + CHAR_REFS_RE_G: /&([A-Za-z0-9\x80-\xff]+);|&\#([0-9]+);|&\#[xX]([0-9A-Fa-f]+);|(&)/g, /** * Blacklist for evil uris like javascript: @@ -568,7 +568,6 @@ // version of node to contain this lastIndex writable bug, // https://github.com/nodejs/node/blob/2cc29517966de7257a2f1b34c58c77225a21e05d/deps/v8/test/webkit/fast/regex/lastIndex-expected.txt#L45 ignoreFields = { - CHAR_REFS_RE: true, EVIL_URI_RE: true, XMLNS_ATTRIBUTE_RE: true, IDN_RE: true, @@ -579,6 +578,7 @@ // Can't freeze the regexp state variables w/ global flag ignoreFields.IDN_RE_G = true; +ignoreFields.CHAR_REFS_RE_G = true; // Freeze it blocking all accidental changes JSUtils.deepFreezeButIgnore(SanitizerConstants, ignoreFields); @@ -833,7 +833,7 @@ * in the text and return a UTF-8 string. */ Sanitizer.decodeCharReferences = function(text) { - return text.replace(SanitizerConstants.CHAR_REFS_RE, function() { + return text.replace(SanitizerConstants.CHAR_REFS_RE_G, function() { if (arguments[1]) { return Sanitizer.decodeEntity(arguments[1]); } else if (arguments[2]) { -- To view, visit https://gerrit.wikimedia.org/r/308224 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib74cd38907ed9de4d23003545c31abe11f63ad17 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: Arlolra <abrea...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits