From f97c1226aac9f3a5b563fc8d95bfeff91b8ab810 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Wed, 12 Oct 2016 13:17:53 +0100 Subject: [PATCH] Prevent HTML parser from mis-recognising email addresses Email addresses such as `` were being erroneously parsed as HTML tags. Fixes #2604 --- core/modules/parsers/wikiparser/rules/html.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/modules/parsers/wikiparser/rules/html.js b/core/modules/parsers/wikiparser/rules/html.js index 71cdfd5dc..6ba685db2 100644 --- a/core/modules/parsers/wikiparser/rules/html.js +++ b/core/modules/parsers/wikiparser/rules/html.js @@ -101,6 +101,11 @@ exports.parseTag = function(source,pos,options) { node.type = node.tag.substr(1); } pos = token.end; + // Check that the tag is terminated by a space, / or > + if(!$tw.utils.parseWhiteSpace(source,pos) && !(source.charAt(pos) === "/") && !(source.charAt(pos) === ">") ) { +console.log("Aborting illegal element tag") + return null; + } // Process attributes var attribute = $tw.utils.parseAttribute(source,pos); while(attribute) {