Merge pull request #2683 from iv-org/SamantazFox-patch-1

Fix #2682
pull/2725/head
Samantaz Fox 2021-12-02 15:35:00 +01:00 zatwierdzone przez GitHub
commit 3e0096f360
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 3 dodań i 1 usunięć

Wyświetl plik

@ -573,7 +573,9 @@ def content_to_comment_html(content)
url = "/watch?v=#{url.request_target.lstrip('/')}" url = "/watch?v=#{url.request_target.lstrip('/')}"
elsif url.host.nil? || url.host.not_nil!.ends_with?("youtube.com") elsif url.host.nil? || url.host.not_nil!.ends_with?("youtube.com")
if url.path == "/redirect" 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 else
url = url.request_target url = url.request_target
end end