summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamantaz Fox <coding@samantaz.fr>2021-12-02 15:35:00 +0100
committerGitHub <noreply@github.com>2021-12-02 15:35:00 +0100
commit3e0096f36006caee346f7c87c249b93f7bd97d5b (patch)
tree42a71dc37222ede0c666ce8557541552ff3e58fc
parent438b334320159343e21f767dd44c366686d5fb25 (diff)
parent342fc202a7c6f34d57b4dbbd22f5df16781327f2 (diff)
downloadinvidious-3e0096f36006caee346f7c87c249b93f7bd97d5b.tar.gz
invidious-3e0096f36006caee346f7c87c249b93f7bd97d5b.tar.bz2
invidious-3e0096f36006caee346f7c87c249b93f7bd97d5b.zip
Merge pull request #2683 from iv-org/SamantazFox-patch-1
Fix #2682
-rw-r--r--src/invidious/comments.cr4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr
index 22e63d3a..12a80bc4 100644
--- a/src/invidious/comments.cr
+++ b/src/invidious/comments.cr
@@ -573,7 +573,9 @@ def content_to_comment_html(content)
url = "/watch?v=#{url.request_target.lstrip('/')}"
elsif url.host.nil? || url.host.not_nil!.ends_with?("youtube.com")
if url.path == "/redirect"
- url = HTTP::Params.parse(url.query.not_nil!)["q"]
+ # Sometimes, links can be corrupted (why?) so make sure to fallback
+ # nicely. See https://github.com/iv-org/invidious/issues/2682
+ url = HTTP::Params.parse(url.query.not_nil!)["q"]? || ""
else
url = url.request_target
end