summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2018-02-15 12:05:39 -0600
committerOmar Roth <omarroth@hotmail.com>2018-02-15 12:05:39 -0600
commit225625a0fbbcf4af4551b8a1a29db916923a2649 (patch)
tree895d370c97ab3f774422d58103fd4fcb44634ef5 /src
parent89566233476b449772229856e0da0c74a01f88f2 (diff)
downloadinvidious-225625a0fbbcf4af4551b8a1a29db916923a2649.tar.gz
invidious-225625a0fbbcf4af4551b8a1a29db916923a2649.tar.bz2
invidious-225625a0fbbcf4af4551b8a1a29db916923a2649.zip
Add redirect for missing params
Diffstat (limited to 'src')
-rw-r--r--src/invidious.cr14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/invidious.cr b/src/invidious.cr
index 1ca461c7..cb95647c 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -150,7 +150,12 @@ get "/" do |env|
end
get "/watch" do |env|
- id = env.params.query["v"]
+ if env.params.query["v"]?
+ id = env.params.query["v"]
+ else
+ env.redirect "/"
+ next
+ end
if env.params.query["listen"]? && env.params.query["listen"] == "true"
listen = true
@@ -246,7 +251,12 @@ get "/watch" do |env|
end
get "/search" do |env|
- query = env.params.query["q"]
+ if env.params.query["q"]?
+ query = env.params.query["q"]
+ else
+ env.redirect "/"
+ next
+ end
page = env.params.query["page"]? && env.params.query["page"].to_i? ? env.params.query["page"].to_i : 1
client = get_client(pool)