Decode percent-encoded characters in domain so that they behave consistently across browsers. #486

This commit is contained in:
ccd0 2015-10-03 15:07:28 -07:00
parent 64944b5132
commit 96312b9fed

View File

@ -127,6 +127,12 @@ Linkify =
'http://'
) + text
# Decode percent-encoded characters in domain so that they behave consistently across browsers.
if encodedDomain = text.match /^(https?:\/\/[^/]*%[0-9a-f]{2})(.*)$/i
text = encodedDomain[1].replace(/%([0-9a-f]{2})/ig, (x, y) ->
if y is '25' then x else String.fromCharCode(parseInt y, 16)
) + encodedDomain[2]
a = $.el 'a',
className: 'linkify'
rel: 'nofollow noreferrer'