aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/validators/oembed.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/server/middlewares/validators/oembed.ts b/server/middlewares/validators/oembed.ts
index 24ba5569d..ab4dbb4d1 100644
--- a/server/middlewares/validators/oembed.ts
+++ b/server/middlewares/validators/oembed.ts
@@ -37,8 +37,11 @@ const oembedValidator = [
37 .end() 37 .end()
38 } 38 }
39 39
40 const startIsOk = req.query.url.startsWith(urlShouldStartWith) 40 const url = req.query.url as string
41 const matches = videoWatchRegex.exec(req.query.url) 41
42 const startIsOk = url.startsWith(urlShouldStartWith)
43 const matches = videoWatchRegex.exec(url)
44
42 if (startIsOk === false || matches === null) { 45 if (startIsOk === false || matches === null) {
43 return res.status(400) 46 return res.status(400)
44 .json({ error: 'Invalid url.' }) 47 .json({ error: 'Invalid url.' })