diff options
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r-- | server/middlewares/validators/videos/video-rates.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/server/middlewares/validators/videos/video-rates.ts b/server/middlewares/validators/videos/video-rates.ts index 7dcba15f1..01bdef25f 100644 --- a/server/middlewares/validators/videos/video-rates.ts +++ b/server/middlewares/validators/videos/video-rates.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { body, param, query } from 'express-validator' | 2 | import { body, param, query } from 'express-validator' |
3 | import { isIdOrUUIDValid } from '../../../helpers/custom-validators/misc' | 3 | import { isIdOrUUIDValid, isIdValid } from '../../../helpers/custom-validators/misc' |
4 | import { isRatingValid } from '../../../helpers/custom-validators/video-rates' | 4 | import { isRatingValid } from '../../../helpers/custom-validators/video-rates' |
5 | import { isVideoRatingTypeValid } from '../../../helpers/custom-validators/videos' | 5 | import { isVideoRatingTypeValid } from '../../../helpers/custom-validators/videos' |
6 | import { logger } from '../../../helpers/logger' | 6 | import { logger } from '../../../helpers/logger' |
@@ -28,14 +28,14 @@ const videoUpdateRateValidator = [ | |||
28 | const getAccountVideoRateValidatorFactory = function (rateType: VideoRateType) { | 28 | const getAccountVideoRateValidatorFactory = function (rateType: VideoRateType) { |
29 | return [ | 29 | return [ |
30 | param('name').custom(isAccountNameValid).withMessage('Should have a valid account name'), | 30 | param('name').custom(isAccountNameValid).withMessage('Should have a valid account name'), |
31 | param('videoId').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid videoId'), | 31 | param('videoId').custom(isIdValid).not().isEmpty().withMessage('Should have a valid videoId'), |
32 | 32 | ||
33 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 33 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
34 | logger.debug('Checking videoCommentGetValidator parameters.', { parameters: req.params }) | 34 | logger.debug('Checking videoCommentGetValidator parameters.', { parameters: req.params }) |
35 | 35 | ||
36 | if (areValidationErrors(req, res)) return | 36 | if (areValidationErrors(req, res)) return |
37 | 37 | ||
38 | const rate = await AccountVideoRateModel.loadLocalAndPopulateVideo(rateType, req.params.name, req.params.videoId) | 38 | const rate = await AccountVideoRateModel.loadLocalAndPopulateVideo(rateType, req.params.name, +req.params.videoId) |
39 | if (!rate) { | 39 | if (!rate) { |
40 | return res.status(HttpStatusCode.NOT_FOUND_404) | 40 | return res.status(HttpStatusCode.NOT_FOUND_404) |
41 | .json({ error: 'Video rate not found' }) | 41 | .json({ error: 'Video rate not found' }) |