summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2018-11-06 09:55:52 -0600
committerOmar Roth <omarroth@hotmail.com>2018-11-06 09:55:52 -0600
commit570e09333a7e19b2444822b67a4ff5d3ff1618dc (patch)
tree1499ae0eb4e88d5bbde6be43147c2a963753955f /src
parent4e33d3a0b9a43fad979dbb0f4e3f365083df5386 (diff)
downloadinvidious-570e09333a7e19b2444822b67a4ff5d3ff1618dc.tar.gz
invidious-570e09333a7e19b2444822b67a4ff5d3ff1618dc.tar.bz2
invidious-570e09333a7e19b2444822b67a4ff5d3ff1618dc.zip
Add error message for empty 'v' param
Diffstat (limited to 'src')
-rw-r--r--src/invidious.cr7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/invidious.cr b/src/invidious.cr
index 7eff86c8..3c251d96 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")