diff options
| author | DoodlesEpic <doodles33@protonmail.com> | 2022-05-24 20:34:36 -0300 |
|---|---|---|
| committer | DoodlesEpic <doodles33@protonmail.com> | 2022-05-24 20:34:36 -0300 |
| commit | ad37db4c820064d08e72014af339c7d789067937 (patch) | |
| tree | 304e3261295a512ecb64dd06ee4ce30735293a1b /src | |
| parent | c2d91c95446452ffa79f00e2c56098511640d9ad (diff) | |
| download | invidious-ad37db4c820064d08e72014af339c7d789067937.tar.gz invidious-ad37db4c820064d08e72014af339c7d789067937.tar.bz2 invidious-ad37db4c820064d08e72014af339c7d789067937.zip | |
Fix document is empty error on yt kids video when reddit comments are enabled
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious/comments.cr | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr index d8496978..1aa14935 100644 --- a/src/invidious/comments.cr +++ b/src/invidious/comments.cr @@ -500,6 +500,12 @@ def template_reddit_comments(root, locale) end def replace_links(html) + # Check if the document is empty + # Prevents edge-case bug with Reddit comments, see issue #3115 + if html.nil? || html.empty? + return html + end + html = XML.parse_html(html) html.xpath_nodes(%q(//a)).each do |anchor| @@ -541,6 +547,12 @@ def replace_links(html) end def fill_links(html, scheme, host) + # Check if the document is empty + # Prevents edge-case bug with Reddit comments, see issue #3115 + if html.nil? || html.empty? + return html + end + html = XML.parse_html(html) html.xpath_nodes("//a").each do |match| |
