Skip to content

Commit 7ecdc5c

Browse files
committed
Use object instead of string.
1 parent ea335df commit 7ecdc5c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/rails/html/sanitizer.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ def sanitize(html, options = {})
106106
return unless html
107107
return html if html.empty?
108108

109-
encoding = html.encoding.name == 'ASCII-8BIT' ? 'UTF-8' : html.encoding.name
110-
loofah_fragment = Loofah.fragment(html, encoding)
109+
encoding = html.encoding == Encoding::ASCII_8BIT ? Encoding::UTF_8 : html.encoding
110+
loofah_fragment = Loofah.fragment(html, encoding.name)
111111

112112
if scrubber = options[:scrubber]
113113
# No duck typing, Loofah ensures subclass of Loofah::Scrubber

0 commit comments

Comments
 (0)