Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/marked.js
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,8 @@ function escape(html, encode) {
}

function unescape(html) {
return html.replace(/&([#\w]+);/g, function(_, n) {
// explicitly match decimal, hex, and named HTML entities
return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g, function(_, n) {
n = n.toLowerCase();
if (n === 'colon') return ':';
if (n.charAt(0) === '#') {
Expand Down
4 changes: 4 additions & 0 deletions test/tests/links.sanitize.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<p></p>
<p></p>
<p></p>
<p></p>
7 changes: 7 additions & 0 deletions test/tests/links.sanitize.text
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[URL](javascript:alert)

[URL](vbscript:alert)

[URL](javascript&colon;alert&#40;1&#41;)

[URL](javascript&#58document;alert&#40;1&#41;)