Skip to content

Commit

Permalink
sanatize uppercase hexidecimal
Browse files Browse the repository at this point in the history
fixes #925
  • Loading branch information
UziTech committed Dec 23, 2017
1 parent 76530ed commit 6d1901f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/marked.js
Original file line number Diff line number Diff line change
Expand Up @@ -1096,8 +1096,8 @@ function escape(html, encode) {
}

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

0 comments on commit 6d1901f

Please sign in to comment.