Return immediately when there's no html to scrub

This commit is contained in:
Régis Hanol 2018-08-23 18:00:07 +02:00
parent 2fcf2b899e
commit f4ae53d52b
1 changed files with 3 additions and 2 deletions

View File

@ -173,9 +173,10 @@ class SearchIndexer
end
def self.scrub(html)
return +"" if html.blank?
me = new
parser = Nokogiri::HTML::SAX::Parser.new(me)
parser.parse("<div>#{html}</div>") if html.present?
Nokogiri::HTML::SAX::Parser.new(me).parse("<div>#{html}</div>")
me.scrubbed
end