From 67c604ae691e372c35dff90e7343c9232dc87511 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 17 Jun 2020 12:42:16 +0200 Subject: [PATCH] Fix server build --- server/middlewares/validators/oembed.ts | 7 +++++-- 1 file 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 = [ .end() } - const startIsOk = req.query.url.startsWith(urlShouldStartWith) - const matches = videoWatchRegex.exec(req.query.url) + const url = req.query.url as string + + const startIsOk = url.startsWith(urlShouldStartWith) + const matches = videoWatchRegex.exec(url) + if (startIsOk === false || matches === null) { return res.status(400) .json({ error: 'Invalid url.' })