diff --git a/lib/html_pipeline.rb b/lib/html_pipeline.rb index 523ec63c..93d0663d 100644 --- a/lib/html_pipeline.rb +++ b/lib/html_pipeline.rb @@ -183,8 +183,8 @@ def call(text, context: {}, result: {}) if @node_filters.empty? instrument("sanitization.html_pipeline", payload) do - result[:output] = Selma::Rewriter.new(sanitizer: @sanitization_config, handlers: @node_filters, options: rewriter_options).rewrite(html) - end unless @convert_filter.nil? # no html, so no sanitization + result[:output] = Selma::Rewriter.new(sanitizer: @sanitization_config, options: rewriter_options).rewrite(html) + end else instrument("call_node_filters.html_pipeline", payload) do @node_filters.each { |filter| filter.context = (filter.context || {}).merge(context) } diff --git a/lib/html_pipeline/version.rb b/lib/html_pipeline/version.rb index 7d8e20a4..617f4bda 100644 --- a/lib/html_pipeline/version.rb +++ b/lib/html_pipeline/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true class HTMLPipeline - VERSION = "3.2.1" + VERSION = "3.2.2" end diff --git a/test/sanitization_filter_test.rb b/test/sanitization_filter_test.rb index fd81c04d..93987d46 100644 --- a/test/sanitization_filter_test.rb +++ b/test/sanitization_filter_test.rb @@ -289,5 +289,23 @@ def test_sanitization_pipeline_does_not_need_node_filters assert_equal(result[:output].to_s, expected.chomp) end + + def test_a_sanitization_only_pipeline_works + config = Selma::Sanitizer::Config.freeze_config({ + elements: [ + "strong", + ], + }) + + pipeline = HTMLPipeline.new( + sanitization_config: config, + ) + + text = "
Some plain text
" + result = pipeline.call(text) + expected = "Some plain text" + + assert_equal(result[:output].to_s, expected) + end end end