aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/oembed.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/oembed.ts')
-rw-r--r--server/middlewares/validators/oembed.ts11
1 files changed, 7 insertions, 4 deletions
diff --git a/server/middlewares/validators/oembed.ts b/server/middlewares/validators/oembed.ts
index 4b8c03faf..f8e34d2d4 100644
--- a/server/middlewares/validators/oembed.ts
+++ b/server/middlewares/validators/oembed.ts
@@ -4,9 +4,12 @@ import { join } from 'path'
4 4
5import { checkErrors } from './utils' 5import { checkErrors } from './utils'
6import { CONFIG } from '../../initializers' 6import { CONFIG } from '../../initializers'
7import { logger } from '../../helpers' 7import {
8import { checkVideoExists, isVideoIdOrUUIDValid } from '../../helpers/custom-validators/videos' 8 logger,
9import { isTestInstance } from '../../helpers/core-utils' 9 isTestInstance,
10 checkVideoExists,
11 isIdOrUUIDValid
12} from '../../helpers'
10 13
11const urlShouldStartWith = CONFIG.WEBSERVER.SCHEME + '://' + join(CONFIG.WEBSERVER.HOST, 'videos', 'watch') + '/' 14const urlShouldStartWith = CONFIG.WEBSERVER.SCHEME + '://' + join(CONFIG.WEBSERVER.HOST, 'videos', 'watch') + '/'
12const videoWatchRegex = new RegExp('([^/]+)$') 15const videoWatchRegex = new RegExp('([^/]+)$')
@@ -45,7 +48,7 @@ const oembedValidator = [
45 } 48 }
46 49
47 const videoId = matches[1] 50 const videoId = matches[1]
48 if (isVideoIdOrUUIDValid(videoId) === false) { 51 if (isIdOrUUIDValid(videoId) === false) {
49 return res.status(400) 52 return res.status(400)
50 .json({ error: 'Invalid video id.' }) 53 .json({ error: 'Invalid video id.' })
51 .end() 54 .end()