mirror of
https://gitea.invidious.io/iv-org/invidious
synced 2024-12-25 08:21:01 +01:00
Fix document is empty error on yt kids video when reddit comments are enabled
This commit is contained in:
parent
c2d91c9544
commit
ad37db4c82
@ -500,6 +500,12 @@ def template_reddit_comments(root, locale)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def replace_links(html)
|
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 = XML.parse_html(html)
|
||||||
|
|
||||||
html.xpath_nodes(%q(//a)).each do |anchor|
|
html.xpath_nodes(%q(//a)).each do |anchor|
|
||||||
@ -541,6 +547,12 @@ def replace_links(html)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def fill_links(html, scheme, host)
|
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 = XML.parse_html(html)
|
||||||
|
|
||||||
html.xpath_nodes("//a").each do |match|
|
html.xpath_nodes("//a").each do |match|
|
||||||
|
Loading…
Reference in New Issue
Block a user