diff --git a/src/invidious.cr b/src/invidious.cr index 7eff86c82..3c251d960 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -212,9 +212,14 @@ get "/watch" do |env| next env.redirect url end - if env.params.query["v"]? && !env.params.query["v"].empty? + if env.params.query["v"]? id = env.params.query["v"] + if env.params.query["v"].empty? + error_message = "Invalid parameters." + next templated "error" + end + if id.size > 11 url = "/watch?v=#{id[0, 11]}" env.params.query.delete_all("v")