summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamantaz Fox <coding@samantaz.fr>2022-06-09 00:33:09 +0200
committerSamantaz Fox <coding@samantaz.fr>2022-06-09 00:33:09 +0200
commit23cd04fe88f15a95e31ecbebe91cafdd9bb14cf8 (patch)
treed8b34798a1a3c6139cf1bccde56ae91ac1f0ea91 /src
parentdbc7c97e0becd64fc6f2ef6a6635cb9564531028 (diff)
parentad37db4c820064d08e72014af339c7d789067937 (diff)
downloadinvidious-23cd04fe88f15a95e31ecbebe91cafdd9bb14cf8.tar.gz
invidious-23cd04fe88f15a95e31ecbebe91cafdd9bb14cf8.tar.bz2
invidious-23cd04fe88f15a95e31ecbebe91cafdd9bb14cf8.zip
Merge pull request #3116 from DoodlesEpic/fix-reddit-comments-nojs-ytkids
Fix document is empty error on yt kids video when reddit comments are enabled
Diffstat (limited to 'src')
-rw-r--r--src/invidious/comments.cr12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr
index 15a15224..593189fd 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|