Skip to content

Commit 2523282

Browse files
author
Juanito Fatas
committed
1 parent 2191bfe commit 2523282

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

lib/rails/html/sanitizer.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def sanitize(html, options = {})
4848
class LinkSanitizer < Sanitizer
4949
def initialize
5050
@link_scrubber = TargetScrubber.new
51-
@link_scrubber.tags = %w(a href)
51+
@link_scrubber.tags = %w(a)
5252
@link_scrubber.attributes = %w(href)
5353
end
5454

@@ -146,7 +146,7 @@ def allowed_tags(options)
146146

147147
def allowed_attributes(options)
148148
options[:attributes] || self.class.allowed_attributes
149-
end
149+
end
150150
end
151151

152152
WhiteListSanitizer = SafeListSanitizer

test/sanitizer_test.rb

-4
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,6 @@ def test_strip_links_with_linkception
154154
assert_equal "Magic", link_sanitize("<a href='http://www.rubyonrails.com/'>Mag<a href='http://www.ruby-lang.org/'>ic")
155155
end
156156

157-
def test_strip_links_with_a_tag_in_href
158-
assert_equal "FrrFox", link_sanitize("<href onlclick='steal()'>FrrFox</a></href>")
159-
end
160-
161157
def test_sanitize_form
162158
assert_sanitized "<form action=\"/foo/bar\" method=\"post\"><input></form>", ''
163159
end

0 commit comments

Comments
 (0)