Merge pull request #2806 from Elberet/fix-escape-single-quotes

FIX: double-escaped single quotes in URLs
This commit is contained in:
Sam 2014-09-19 13:32:43 +10:00
commit bf51fbf030
2 changed files with 2 additions and 2 deletions

View File

@ -166,7 +166,7 @@ Discourse.Markdown = {
var url = typeof(uri) === "string" ? uri : uri.toString(); var url = typeof(uri) === "string" ? uri : uri.toString();
// escape single quotes // escape single quotes
url = url.replace(/'/g, "'"); url = url.replace(/'/g, "%27");
// whitelist some iframe only // whitelist some iframe only
if (hints && hints.XML_TAG === "iframe" && hints.XML_ATTR === "src") { if (hints && hints.XML_TAG === "iframe" && hints.XML_ATTR === "src") {

View File

@ -458,7 +458,7 @@ test("urlAllowed", function() {
allowed("//eviltrout.com/evil/trout", "allows protocol relative urls"); allowed("//eviltrout.com/evil/trout", "allows protocol relative urls");
equal(urlAllowed("http://google.com/test'onmouseover=alert('XSS!');//.swf"), equal(urlAllowed("http://google.com/test'onmouseover=alert('XSS!');//.swf"),
"http://google.com/test'onmouseover=alert('XSS!');//.swf", "http://google.com/test%27onmouseover=alert(%27XSS!%27);//.swf",
"escape single quotes"); "escape single quotes");
}); });