diff options
Diffstat (limited to 'server/middlewares/validators/oembed.ts')
-rw-r--r-- | server/middlewares/validators/oembed.ts | 11 |
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 | ||
5 | import { checkErrors } from './utils' | 5 | import { checkErrors } from './utils' |
6 | import { CONFIG } from '../../initializers' | 6 | import { CONFIG } from '../../initializers' |
7 | import { logger } from '../../helpers' | 7 | import { |
8 | import { checkVideoExists, isVideoIdOrUUIDValid } from '../../helpers/custom-validators/videos' | 8 | logger, |
9 | import { isTestInstance } from '../../helpers/core-utils' | 9 | isTestInstance, |
10 | checkVideoExists, | ||
11 | isIdOrUUIDValid | ||
12 | } from '../../helpers' | ||
10 | 13 | ||
11 | const urlShouldStartWith = CONFIG.WEBSERVER.SCHEME + '://' + join(CONFIG.WEBSERVER.HOST, 'videos', 'watch') + '/' | 14 | const urlShouldStartWith = CONFIG.WEBSERVER.SCHEME + '://' + join(CONFIG.WEBSERVER.HOST, 'videos', 'watch') + '/' |
12 | const videoWatchRegex = new RegExp('([^/]+)$') | 15 | const 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() |