From e7cad23bb9118e7bdc0b1697f317c9813f68e516 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Sat, 4 Aug 2018 17:19:42 -0500 Subject: [PATCH] Try to redirect invalid video IDs --- src/invidious.cr | 8 ++++++++ 1 file changed, 8 insertions(+) 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