diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-25 16:23:44 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-07-25 16:23:44 +0200 |
commit | c8861d5dc0436ef4342ce517241e3591fa256a13 (patch) | |
tree | ca47c09d1f7f1e2aa62c684d576faa938eb47af7 /server/middlewares/validators/redundancy.ts | |
parent | b4c19345c19b0891142c69308cd9447f2161188c (diff) | |
download | PeerTube-c8861d5dc0436ef4342ce517241e3591fa256a13.tar.gz PeerTube-c8861d5dc0436ef4342ce517241e3591fa256a13.tar.zst PeerTube-c8861d5dc0436ef4342ce517241e3591fa256a13.zip |
Fix express validator
Diffstat (limited to 'server/middlewares/validators/redundancy.ts')
-rw-r--r-- | server/middlewares/validators/redundancy.ts | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/server/middlewares/validators/redundancy.ts b/server/middlewares/validators/redundancy.ts index edc53a6b2..1fdac0e4e 100644 --- a/server/middlewares/validators/redundancy.ts +++ b/server/middlewares/validators/redundancy.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import 'express-validator' | 2 | import { body, param } from 'express-validator' |
3 | import { body, param } from 'express-validator/check' | 3 | import { exists, isBooleanValid, isIdOrUUIDValid, toBooleanOrNull, toIntOrNull } from '../../helpers/custom-validators/misc' |
4 | import { exists, isBooleanValid, isIdOrUUIDValid, toIntOrNull } from '../../helpers/custom-validators/misc' | ||
5 | import { logger } from '../../helpers/logger' | 4 | import { logger } from '../../helpers/logger' |
6 | import { areValidationErrors } from './utils' | 5 | import { areValidationErrors } from './utils' |
7 | import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy' | 6 | import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy' |
@@ -68,7 +67,7 @@ const videoPlaylistRedundancyGetValidator = [ | |||
68 | const updateServerRedundancyValidator = [ | 67 | const updateServerRedundancyValidator = [ |
69 | param('host').custom(isHostValid).withMessage('Should have a valid host'), | 68 | param('host').custom(isHostValid).withMessage('Should have a valid host'), |
70 | body('redundancyAllowed') | 69 | body('redundancyAllowed') |
71 | .toBoolean() | 70 | .customSanitizer(toBooleanOrNull) |
72 | .custom(isBooleanValid).withMessage('Should have a valid redundancyAllowed attribute'), | 71 | .custom(isBooleanValid).withMessage('Should have a valid redundancyAllowed attribute'), |
73 | 72 | ||
74 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 73 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |