From 65be2c99b026bb8c387b527cfde49c015968722e Mon Sep 17 00:00:00 2001 From: evazion Date: Wed, 6 Jan 2021 03:05:36 -0600 Subject: [PATCH] Fix #4657: Hentai-Foundry: Document tree depth limit exceeded. --- app/logical/danbooru/http/html_adapter.rb | 2 +- test/unit/sources/hentai_foundry_test.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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