diff --git a/app/logical/danbooru/http/html_adapter.rb b/app/logical/danbooru/http/html_adapter.rb
index 733208e17..6c063b026 100644
--- a/app/logical/danbooru/http/html_adapter.rb
+++ b/app/logical/danbooru/http/html_adapter.rb
@@ -5,7 +5,7 @@ module Danbooru
HTTP::MimeType.register_alias "text/html", :html
def decode(str)
- Nokogiri::HTML5(str)
+ Nokogiri::HTML5(str, max_tree_depth: -1)
end
end
end
diff --git a/test/unit/sources/hentai_foundry_test.rb b/test/unit/sources/hentai_foundry_test.rb
index af9002c2f..31ed2f85a 100644
--- a/test/unit/sources/hentai_foundry_test.rb
+++ b/test/unit/sources/hentai_foundry_test.rb
@@ -102,5 +102,12 @@ module Sources
assert_equal(bad_source, Sources::Strategies.normalize_source(bad_source))
end
end
+
+ context "a post with a deeply nested commentary" do
+ should "work" do
+ @source = Sources::Strategies.find("https://hentai-foundry.com/pictures/user/LumiNyu/867562/Mona-patreon-winner")
+ assert_nothing_raised { @source.to_h }
+ end
+ end
end
end