diff options
Diffstat (limited to 'server/middlewares/validators/videos/videos.ts')
-rw-r--r-- | server/middlewares/validators/videos/videos.ts | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts index 8201e80c3..49e10e2b5 100644 --- a/server/middlewares/validators/videos/videos.ts +++ b/server/middlewares/validators/videos/videos.ts | |||
@@ -12,7 +12,6 @@ import { | |||
12 | isBooleanValid, | 12 | isBooleanValid, |
13 | isDateValid, | 13 | isDateValid, |
14 | isFileFieldValid, | 14 | isFileFieldValid, |
15 | isIdOrUUIDValid, | ||
16 | isIdValid, | 15 | isIdValid, |
17 | isUUIDValid, | 16 | isUUIDValid, |
18 | toArray, | 17 | toArray, |
@@ -53,7 +52,8 @@ import { | |||
53 | checkUserCanManageVideo, | 52 | checkUserCanManageVideo, |
54 | doesVideoChannelOfAccountExist, | 53 | doesVideoChannelOfAccountExist, |
55 | doesVideoExist, | 54 | doesVideoExist, |
56 | doesVideoFileOfVideoExist | 55 | doesVideoFileOfVideoExist, |
56 | isValidVideoIdParam | ||
57 | } from '../shared' | 57 | } from '../shared' |
58 | 58 | ||
59 | const videosAddLegacyValidator = getCommonVideoEditAttributes().concat([ | 59 | const videosAddLegacyValidator = getCommonVideoEditAttributes().concat([ |
@@ -195,7 +195,8 @@ const videosAddResumableInitValidator = getCommonVideoEditAttributes().concat([ | |||
195 | ]) | 195 | ]) |
196 | 196 | ||
197 | const videosUpdateValidator = getCommonVideoEditAttributes().concat([ | 197 | const videosUpdateValidator = getCommonVideoEditAttributes().concat([ |
198 | param('id').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'), | 198 | isValidVideoIdParam('id'), |
199 | |||
199 | body('name') | 200 | body('name') |
200 | .optional() | 201 | .optional() |
201 | .trim() | 202 | .trim() |
@@ -258,7 +259,7 @@ const videosCustomGetValidator = ( | |||
258 | authenticateInQuery = false | 259 | authenticateInQuery = false |
259 | ) => { | 260 | ) => { |
260 | return [ | 261 | return [ |
261 | param('id').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'), | 262 | isValidVideoIdParam('id'), |
262 | 263 | ||
263 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 264 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
264 | logger.debug('Checking videosGet parameters', { parameters: req.params }) | 265 | logger.debug('Checking videosGet parameters', { parameters: req.params }) |
@@ -309,8 +310,10 @@ const videosGetValidator = videosCustomGetValidator('all') | |||
309 | const videosDownloadValidator = videosCustomGetValidator('all', true) | 310 | const videosDownloadValidator = videosCustomGetValidator('all', true) |
310 | 311 | ||
311 | const videoFileMetadataGetValidator = getCommonVideoEditAttributes().concat([ | 312 | const videoFileMetadataGetValidator = getCommonVideoEditAttributes().concat([ |
312 | param('id').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'), | 313 | isValidVideoIdParam('id'), |
313 | param('videoFileId').custom(isIdValid).not().isEmpty().withMessage('Should have a valid videoFileId'), | 314 | |
315 | param('videoFileId') | ||
316 | .custom(isIdValid).not().isEmpty().withMessage('Should have a valid videoFileId'), | ||
314 | 317 | ||
315 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 318 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
316 | logger.debug('Checking videoFileMetadataGet parameters', { parameters: req.params }) | 319 | logger.debug('Checking videoFileMetadataGet parameters', { parameters: req.params }) |
@@ -323,7 +326,7 @@ const videoFileMetadataGetValidator = getCommonVideoEditAttributes().concat([ | |||
323 | ]) | 326 | ]) |
324 | 327 | ||
325 | const videosRemoveValidator = [ | 328 | const videosRemoveValidator = [ |
326 | param('id').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'), | 329 | isValidVideoIdParam('id'), |
327 | 330 | ||
328 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 331 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
329 | logger.debug('Checking videosRemove parameters', { parameters: req.params }) | 332 | logger.debug('Checking videosRemove parameters', { parameters: req.params }) |