FIX: Use Nokogiri and Loofah consistently (PR #12693)

CookedPostProcessor used Loofah to parse the cooked content of a post and Nokogiri to parse cooked Oneboxes. Even though Loofah is built on top of Nokogiri, replacing an element from the cooked post (a Nokogiri node) with a parsed onebox (a Loofah node) produced a strange result which included XML namespaces. Removing the mix and using Loofah to parse Oneboxes fixed the problem.


Awesome! I’m happy you fixed this bug!

I’m curious what you think of onebox (the gem) still using nokogiri for preview ? onebox/preview.rb at master · discourse/onebox · GitHub Given we use the resulting html, could it cause the same kind of issue ?

It is a problem only as long as we combine Nokogiri and Loofah together. As long as we only use of them, either Nokogiri or Loofah, everything is working correctly.