mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 05:34:28 +08:00
Merge pull request #2806 from Elberet/fix-escape-single-quotes
FIX: double-escaped single quotes in URLs
This commit is contained in:
commit
bf51fbf030
|
@ -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") {
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user