aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/video-channels.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-05-25 09:57:16 +0200
committerChocobozzz <me@florianbigard.com>2018-05-25 10:41:07 +0200
commitad9e39fb815d85e5e718c40540fa75471474fa17 (patch)
tree960accb16bca0fac7694b3f3d5d038534b66c224 /server/middlewares/validators/video-channels.ts
parent06be7ed0b27b371465c5d1b7f92b4adfb0b866ea (diff)
downloadPeerTube-ad9e39fb815d85e5e718c40540fa75471474fa17.tar.gz
PeerTube-ad9e39fb815d85e5e718c40540fa75471474fa17.tar.zst
PeerTube-ad9e39fb815d85e5e718c40540fa75471474fa17.zip
Only use account name in routes
Diffstat (limited to 'server/middlewares/validators/video-channels.ts')
-rw-r--r--server/middlewares/validators/video-channels.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/server/middlewares/validators/video-channels.ts b/server/middlewares/validators/video-channels.ts
index 92c0de419..a5be5f114 100644
--- a/server/middlewares/validators/video-channels.ts
+++ b/server/middlewares/validators/video-channels.ts
@@ -1,7 +1,7 @@
1import * as express from 'express' 1import * as express from 'express'
2import { body, param } from 'express-validator/check' 2import { body, param } from 'express-validator/check'
3import { UserRight } from '../../../shared' 3import { UserRight } from '../../../shared'
4import { isAccountIdExist } from '../../helpers/custom-validators/accounts' 4import { isAccountIdExist, isAccountNameWithHostExist } from '../../helpers/custom-validators/accounts'
5import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' 5import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc'
6import { 6import {
7 isVideoChannelDescriptionValid, 7 isVideoChannelDescriptionValid,
@@ -15,13 +15,13 @@ import { VideoChannelModel } from '../../models/video/video-channel'
15import { areValidationErrors } from './utils' 15import { areValidationErrors } from './utils'
16 16
17const listVideoAccountChannelsValidator = [ 17const listVideoAccountChannelsValidator = [
18 param('accountId').custom(isIdOrUUIDValid).withMessage('Should have a valid account id'), 18 param('accountName').exists().withMessage('Should have a valid account name'),
19 19
20 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 20 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
21 logger.debug('Checking listVideoAccountChannelsValidator parameters', { parameters: req.body }) 21 logger.debug('Checking listVideoAccountChannelsValidator parameters', { parameters: req.body })
22 22
23 if (areValidationErrors(req, res)) return 23 if (areValidationErrors(req, res)) return
24 if (!await isAccountIdExist(req.params.accountId, res)) return 24 if (!await isAccountNameWithHostExist(req.params.accountName, res)) return
25 25
26 return next() 26 return next()
27 } 27 }