From 2e6e1e6623df6852b5eb8afd9f634e06c1c9b69f Mon Sep 17 00:00:00 2001 From: syeopite Date: Tue, 31 Aug 2021 16:36:39 -0700 Subject: [PATCH] Handle url.host correctly --- src/invidious/comments.cr | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr index cba425a5..3a4328a5 100644 --- a/src/invidious/comments.cr +++ b/src/invidious/comments.cr @@ -552,10 +552,9 @@ def content_to_comment_html(content) if url = run["navigationEndpoint"]["urlEndpoint"]?.try &.["url"].as_s url = URI.parse(url) - if !url.host - elsif url.host == "youtu.be" + if url.host == "youtu.be" url = "/watch?v=#{url.request_target.lstrip('/')}" - elsif {"m.youtube.com", "www.youtube.com"}.includes? url + elsif !url.host || {"m.youtube.com", "www.youtube.com"}.includes? url if url.path == "/redirect" url = HTTP::Params.parse(url.query.not_nil!)["q"] else