Allow rel attribute in sanitizer Fixes issue #68.
Vytautas Ĺ altenis vytas@rtfb.lt
Thu, 01 May 2014 20:49:49 +0300
2 files changed,
4 insertions(+),
4 deletions(-)
M
inline_test.go
→
inline_test.go
@@ -524,10 +524,10 @@ }
func TestNofollowLink(t *testing.T) { var tests = []string{ - "[foo](/bar/)\n", - "<p><a href=\"/bar/\" rel=\"nofollow\">foo</a></p>\n", + "[foo](http://bar.baz/)\n", + "<p><a href=\"http://bar.baz/\" rel=\"nofollow\">foo</a></p>\n", } - doTestsInlineParam(t, tests, 0, HTML_SAFELINK|HTML_NOFOLLOW_LINKS) + doTestsInlineParam(t, tests, 0, HTML_SAFELINK|HTML_NOFOLLOW_LINKS|HTML_SANITIZE_OUTPUT) } func TestSafeInlineLink(t *testing.T) {
M
sanitize.go
→
sanitize.go
@@ -26,7 +26,7 @@ "i", "img", "li", "ol", "p", "pre", "q", "small", "strike", "strong",
"sub", "sup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "u", "ul"}) whitelistAttrs = map[string]map[string]bool{ - "a": toSet([]string{"href", "title"}), + "a": toSet([]string{"href", "title", "rel"}), "img": toSet([]string{"src", "alt", "title"}), } protocolAttrs = map[string]map[string]bool{