Browse Source

Fix regression in HtmlSanitizer::cleanup_target (whitespace deletion)

Ryan Lue 6 years ago
parent
commit
23f30921dc
1 changed files with 1 additions and 1 deletions
  1. 1 1
      lib/html_sanitizer.rb

+ 1 - 1
lib/html_sanitizer.rb

@@ -375,7 +375,7 @@ cleanup html string:
 
   def self.cleanup_target(string, **options)
     cleaned_string = CGI.unescape(string).utf8_encode(fallback: :read_as_sanitized_binary)
-    cleaned_string = cleaned_string.delete(' ') unless options[:keep_spaces]
+    cleaned_string = cleaned_string.gsub(/[[:space:]]/, '') if !options[:keep_spaces]
     cleaned_string = cleaned_string.strip
                                    .delete("\t\n\r\u0000")
                                    .gsub(%r{/\*.*?\*/}, '')