FIX: double-escaped single quotes in URLs

This commit is contained in:
Jens Maier 2014-09-18 22:00:34 +02:00
parent da91ab25cf
commit 543bc53598
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();
// escape single quotes
url = url.replace(/'/g, "'");
url = url.replace(/'/g, "%27");
// whitelist some iframe only
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");
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");
});