diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-10-24 19:41:09 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-10-26 09:11:38 +0200 |
commit | 72c7248b6fdcdb2175e726ff51b42e7555f2bd84 (patch) | |
tree | 1bfdee99dbe2392cc997edba8e314e2a8a401c72 /server/middlewares/validators/oembed.ts | |
parent | 8113a93a0d9f31aa9e23702bbc31b8a76275ae22 (diff) | |
download | PeerTube-72c7248b6fdcdb2175e726ff51b42e7555f2bd84.tar.gz PeerTube-72c7248b6fdcdb2175e726ff51b42e7555f2bd84.tar.zst PeerTube-72c7248b6fdcdb2175e726ff51b42e7555f2bd84.zip |
Add video channels
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() |