summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2018-08-04 17:19:42 -0500
committerOmar Roth <omarroth@hotmail.com>2018-08-04 17:19:55 -0500
commite7cad23bb9118e7bdc0b1697f317c9813f68e516 (patch)
treeb630b8e3cec8412bcfd685da36c25bfb7d741939 /src
parent3ada6a92348ea2133f2eb0b2387ce7fb490e2e67 (diff)
downloadinvidious-e7cad23bb9118e7bdc0b1697f317c9813f68e516.tar.gz
invidious-e7cad23bb9118e7bdc0b1697f317c9813f68e516.tar.bz2
invidious-e7cad23bb9118e7bdc0b1697f317c9813f68e516.zip
Try to redirect invalid video IDs
Diffstat (limited to 'src')
-rw-r--r--src/invidious.cr8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/invidious.cr b/src/invidious.cr
index 0a023345..310aca04 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -173,6 +173,10 @@ end
get "/watch" do |env|
if env.params.query["v"]?
id = env.params.query["v"]
+
+ if id.size > 11
+ next env.redirect "/watch?v=#{id[0, 11]}"
+ end
else
next env.redirect "/"
end
@@ -355,6 +359,10 @@ end
get "/embed/:id" do |env|
if env.params.url["id"]?
id = env.params.url["id"]
+
+ if id.size > 11
+ next env.redirect "/embed/#{id[0, 11]}"
+ end
else
next env.redirect "/"
end