Files
danbooru/app/logical/danbooru/http/html_adapter.rb
evazion a7dc05ce63 Enable frozen string literals.
Make all string literals immutable by default.
2021-12-14 21:33:27 -06:00

16 lines
421 B
Ruby

# frozen_string_literal: true
module Danbooru
class Http
class HtmlAdapter < HTTP::MimeType::Adapter
HTTP::MimeType.register_adapter "text/html", self
HTTP::MimeType.register_alias "text/html", :html
def decode(str)
# XXX technically should use the charset from the http headers.
Nokogiri::HTML5.parse(str.force_encoding("utf-8"), max_tree_depth: -1)
end
end
end
end