diff options
author | Timm <kaspth@gmail.com> | 2013-07-15 21:54:43 +0200 |
---|---|---|
committer | Timm <kaspth@gmail.com> | 2014-06-15 23:40:54 +0200 |
commit | 6241bb8cf45979cc9ffaa916ed83e7cc6b48a38e (patch) | |
tree | cb52e8ec488f8d7f169033fbcd624808fb2220d5 /actionview/lib/action_view/helpers/sanitize_helper | |
parent | c88d573739186c344f39a068a6f972804b17efe8 (diff) | |
download | rails-6241bb8cf45979cc9ffaa916ed83e7cc6b48a38e.tar.gz rails-6241bb8cf45979cc9ffaa916ed83e7cc6b48a38e.tar.bz2 rails-6241bb8cf45979cc9ffaa916ed83e7cc6b48a38e.zip |
Added ability to pass a custom scrubber to sanitize. Includes test coverage.
Diffstat (limited to 'actionview/lib/action_view/helpers/sanitize_helper')
-rw-r--r-- | actionview/lib/action_view/helpers/sanitize_helper/sanitizers.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/sanitize_helper/sanitizers.rb b/actionview/lib/action_view/helpers/sanitize_helper/sanitizers.rb index af0aa12349..eab6d6a515 100644 --- a/actionview/lib/action_view/helpers/sanitize_helper/sanitizers.rb +++ b/actionview/lib/action_view/helpers/sanitize_helper/sanitizers.rb @@ -56,7 +56,9 @@ module ActionView return nil unless html loofah_fragment = Loofah.fragment(html) - if options[:tags] || options[:attributes] + if scrubber = options[:scrubber] # Loofah makes sure this is a scrubber + loofah_fragment.scrub!(scrubber) + elsif options[:tags] || options[:attributes] @permit_scrubber.tags = options[:tags] @permit_scrubber.attributes = options[:attributes] loofah_fragment.scrub!(@permit_scrubber) |