fix <a> regexp to allow for href="/"

This commit is contained in:
rolux 2013-02-27 16:27:44 +05:30
parent 65ecc61112
commit 89408bd4be

View file

@ -29,7 +29,7 @@
replace = { replace = {
a: [ a: [
[ [
/<a [^<>]*?href="((\/|https?:\/\/|mailto:).+?)".*?>/gi, /<a [^<>]*?href="((\/|https?:\/\/|mailto:).*?)".*?>/gi,
'<a href="{1}">', '<a href="{1}">',
], ],
[ [
@ -482,6 +482,8 @@
'&lt;a href="foo"&gt;foo' '&lt;a href="foo"&gt;foo'
> Ox.sanitizeHTML('<a href="/foo">foo</a>') > Ox.sanitizeHTML('<a href="/foo">foo</a>')
'<a href="/foo">foo</a>' '<a href="/foo">foo</a>'
> Ox.sanitizeHTML('<a href="/">foo</a>')
'<a href="/">foo</a>'
> Ox.sanitizeHTML('[http://foo.com foo]') > Ox.sanitizeHTML('[http://foo.com foo]')
'<a href="http://foo.com">foo</a>' '<a href="http://foo.com">foo</a>'
> Ox.sanitizeHTML('<rtl>foo</rtl>') > Ox.sanitizeHTML('<rtl>foo</rtl>')