From 240085d0056fd97ac3c7fa8fa4ce9bc32afc4d6e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 23 Aug 2018 10:30:53 +0200 Subject: Fix tests --- server/controllers/api/search.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'server/controllers') diff --git a/server/controllers/api/search.ts b/server/controllers/api/search.ts index d95e7cac9..f408e7932 100644 --- a/server/controllers/api/search.ts +++ b/server/controllers/api/search.ts @@ -39,8 +39,9 @@ export { searchRouter } function searchVideos (req: express.Request, res: express.Response) { const query: VideosSearchQuery = req.query - if (query.search.startsWith('http://') || query.search.startsWith('https://')) { - return searchVideoUrl(query.search, res) + const search = query.search + if (search && (search.startsWith('http://') || search.startsWith('https://'))) { + return searchVideoUrl(search, res) } return searchVideosDB(query, res) -- cgit v1.2.3