summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsyeopite <70992037+syeopite@users.noreply.github.com>2021-09-01 10:59:47 +0000
committerGitHub <noreply@github.com>2021-09-01 12:59:47 +0200
commita1001ada479c4e6ad03fa34b74f035d171b24ce5 (patch)
tree6e46bd519c0fbc3eda3dc9c41adcaf317ecb021f
parentf938aa530e5adbf06b35f7927057a8b0f64b4756 (diff)
downloadinvidious-a1001ada479c4e6ad03fa34b74f035d171b24ce5.tar.gz
invidious-a1001ada479c4e6ad03fa34b74f035d171b24ce5.tar.bz2
invidious-a1001ada479c4e6ad03fa34b74f035d171b24ce5.zip
Properly transform youtu.be links to be /watch routes in comments and descriptions (#2365)
-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 141a526d..3a4328a5 100644
--- a/src/invidious/comments.cr
+++ b/src/invidious/comments.cr
@@ -552,7 +552,9 @@ def content_to_comment_html(content)
if url = run["navigationEndpoint"]["urlEndpoint"]?.try &.["url"].as_s
url = URI.parse(url)
- if !url.host || {"m.youtube.com", "www.youtube.com", "youtu.be"}.includes? url.host
+ if url.host == "youtu.be"
+ url = "/watch?v=#{url.request_target.lstrip('/')}"
+ 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