fix Ox.sanitzeHTML if urls are inside an open a tag
This commit is contained in:
parent
cd6e17d124
commit
53966f3f53
1 changed files with 4 additions and 1 deletions
|
@ -434,6 +434,8 @@
|
||||||
'<a href="mailto:foo@bar.com">foo</a>'
|
'<a href="mailto:foo@bar.com">foo</a>'
|
||||||
> Ox.sanitizeHTML('<a href="http://foo.com">foo</a>')
|
> Ox.sanitizeHTML('<a href="http://foo.com">foo</a>')
|
||||||
'<a href="http://foo.com">foo</a>'
|
'<a href="http://foo.com">foo</a>'
|
||||||
|
> Ox.sanitizeHTML('<a href="http://www.foo.com/">http://www.foo.com/</a>')
|
||||||
|
'<a href="http://www.foo.com/">http://www.foo.com/</a>'
|
||||||
> Ox.sanitizeHTML('<a href="http://foo.com" onclick="alert()">foo</a>')
|
> Ox.sanitizeHTML('<a href="http://foo.com" onclick="alert()">foo</a>')
|
||||||
'<a href="http://foo.com">foo</a>'
|
'<a href="http://foo.com">foo</a>'
|
||||||
> Ox.sanitizeHTML('<a href="javascript:alert()">foo</a>')
|
> Ox.sanitizeHTML('<a href="javascript:alert()">foo</a>')
|
||||||
|
@ -474,10 +476,11 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
html = Ox.addLinks(Ox.encodeHTMLEntities(html), true);
|
html = Ox.encodeHTMLEntities(html);
|
||||||
matches.forEach(function(match, i) {
|
matches.forEach(function(match, i) {
|
||||||
html = html.replace(new RegExp(salt.join(i)), match);
|
html = html.replace(new RegExp(salt.join(i)), match);
|
||||||
});
|
});
|
||||||
|
html = Ox.addLinks(html, true);
|
||||||
html = html.replace(/\n\n/g, '<br/><br/>');
|
html = html.replace(/\n\n/g, '<br/><br/>');
|
||||||
// Close extra opening and remove extra closing tags.
|
// Close extra opening and remove extra closing tags.
|
||||||
// Note: this converts ''' to "'" and '"' to '"'
|
// Note: this converts ''' to "'" and '"' to '"'
|
||||||
|
|
Loading…
Reference in a new issue