rails-html-sanitizer 1.6.0.rc1 → 1.6.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 369872075a1b555eb1dbcdf744e8d9f01aa4ba4c8f29449ba61668da5c4063ff
4
- data.tar.gz: 1ae0e8e36e37c51687c965c33d55c1a1eaaab9d4e71d089378ee62fc340e0cd1
3
+ metadata.gz: 3ce8562c96b3e842ebf50227e682c3fa948ebf8474786f100dbf78adff7f98d0
4
+ data.tar.gz: 7ca7beb76be35dea0dd926819212445e885a2b205ca0b2e45628f58d734a1a9f
5
5
  SHA512:
6
- metadata.gz: f8c948ee3f76bb85018a3491d97f89b2957247f2cae35b650ee8d1682d482377e76e2150bbf8a81a9a1aaea4384af321c36c9a621c0c1a71a5dd079cb482a144
7
- data.tar.gz: 070f318bcdfb024310b59fc8ceec848c937e0d7e5c4824c40cbb80a9b783e96d98b3f8f67a19630f6fe26aaee35769df84e24aefb198b58a0b06f825a18259a4
6
+ metadata.gz: 30d9b9288698da75f713811e8b507edda0645eb4a485b0466847a4b8246aa854cd12e4dae238e61b09e371c950ee8516595b39207d4b10323bf81cf74b0a5114
7
+ data.tar.gz: 81698f017c423bac3434e7129b70c4ecba80b27a4f8c6d86294d548aeeb9238d98cd65c15f06bcf62c6ee104e8b3beca782c8e9b338302590c33b65ab9ed8121
data/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
- ## 1.6.0.rc1 / 2023-05-24
1
+ ## 1.6.0.rc2 / 2023-05-24
2
2
 
3
- * Sanitizers that use an HTML5 parser are now available on platforms supported by
3
+ * HTML5 standards-compliant sanitizers are now available on platforms supported by
4
4
  Nokogiri::HTML5. These are available as:
5
5
 
6
6
  - `Rails::HTML5::FullSanitizer`
@@ -13,6 +13,9 @@
13
13
  Note that for symmetry `Rails::HTML4::Sanitizer` is also added, though its behavior is identical
14
14
  to the vendor class methods on `Rails::HTML::Sanitizer`.
15
15
 
16
+ Users may call `Rails::HTML::Sanitizer.best_supported_vendor` to get back the HTML5 vendor if it's
17
+ supported, else the legacy HTML4 vendor.
18
+
16
19
  *Mike Dalessio*
17
20
 
18
21
  * Module namespaces have changed, but backwards compatibility is provided by aliases.
@@ -3,7 +3,7 @@
3
3
  module Rails
4
4
  module HTML
5
5
  class Sanitizer
6
- VERSION = "1.6.0.rc1"
6
+ VERSION = "1.6.0.rc2"
7
7
  end
8
8
  end
9
9
  end
@@ -9,6 +9,10 @@ module Rails
9
9
 
10
10
  @html5_support = Loofah.respond_to?(:html5_support?) && Loofah.html5_support?
11
11
  end
12
+
13
+ def best_supported_vendor
14
+ html5_support? ? Rails::HTML5::Sanitizer : Rails::HTML4::Sanitizer
15
+ end
12
16
  end
13
17
 
14
18
  def sanitize(html, options = {})
@@ -17,6 +17,20 @@ class RailsApiTest < Minitest::Test
17
17
  assert(Rails::Html::Sanitizer)
18
18
  end
19
19
 
20
+ def test_best_supported_vendor_when_html5_is_not_supported_returns_html4
21
+ Rails::HTML::Sanitizer.stub(:html5_support?, false) do
22
+ assert_equal(Rails::HTML4::Sanitizer, Rails::HTML::Sanitizer.best_supported_vendor)
23
+ end
24
+ end
25
+
26
+ def test_best_supported_vendor_when_html5_is_supported_returns_html5
27
+ skip("no HTML5 support on this platform") unless Rails::HTML::Sanitizer.html5_support?
28
+
29
+ Rails::HTML::Sanitizer.stub(:html5_support?, true) do
30
+ assert_equal(Rails::HTML5::Sanitizer, Rails::HTML::Sanitizer.best_supported_vendor)
31
+ end
32
+ end
33
+
20
34
  def test_html4_sanitizer_alias_full
21
35
  assert_equal(Rails::HTML4::FullSanitizer, Rails::HTML::FullSanitizer)
22
36
  assert_equal("Rails::HTML4::FullSanitizer", Rails::HTML::FullSanitizer.name)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-html-sanitizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0.rc1
4
+ version: 1.6.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafael Mendonça França
@@ -64,9 +64,9 @@ licenses:
64
64
  - MIT
65
65
  metadata:
66
66
  bug_tracker_uri: https://github.com/rails/rails-html-sanitizer/issues
67
- changelog_uri: https://github.com/rails/rails-html-sanitizer/blob/v1.6.0.rc1/CHANGELOG.md
68
- documentation_uri: https://www.rubydoc.info/gems/rails-html-sanitizer/1.6.0.rc1
69
- source_code_uri: https://github.com/rails/rails-html-sanitizer/tree/v1.6.0.rc1
67
+ changelog_uri: https://github.com/rails/rails-html-sanitizer/blob/v1.6.0.rc2/CHANGELOG.md
68
+ documentation_uri: https://www.rubydoc.info/gems/rails-html-sanitizer/1.6.0.rc2
69
+ source_code_uri: https://github.com/rails/rails-html-sanitizer/tree/v1.6.0.rc2
70
70
  post_install_message:
71
71
  rdoc_options: []
72
72
  require_paths: