Skip to content

Commit

Permalink
href is not a HTML element
Browse files Browse the repository at this point in the history
  • Loading branch information
Juanito Fatas committed May 10, 2019
1 parent 2191bfe commit 2523282
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/rails/html/sanitizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def sanitize(html, options = {})
class LinkSanitizer < Sanitizer
def initialize
@link_scrubber = TargetScrubber.new
@link_scrubber.tags = %w(a href)
@link_scrubber.tags = %w(a)
@link_scrubber.attributes = %w(href)
end

Expand Down Expand Up @@ -146,7 +146,7 @@ def allowed_tags(options)

def allowed_attributes(options)
options[:attributes] || self.class.allowed_attributes
end
end
end

WhiteListSanitizer = SafeListSanitizer
Expand Down
4 changes: 0 additions & 4 deletions test/sanitizer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,6 @@ def test_strip_links_with_linkception
assert_equal "Magic", link_sanitize("<a href='http://www.rubyonrails.com/'>Mag<a href='http://www.ruby-lang.org/'>ic")
end

def test_strip_links_with_a_tag_in_href
assert_equal "FrrFox", link_sanitize("<href onlclick='steal()'>FrrFox</a></href>")
end

def test_sanitize_form
assert_sanitized "<form action=\"/foo/bar\" method=\"post\"><input></form>", ''
end
Expand Down

0 comments on commit 2523282

Please sign in to comment.