diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-29 10:27:24 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-29 10:27:24 +0200 |
commit | b033851fb54241bb703f86add025229e68cc6f59 (patch) | |
tree | d60dac1499a95bf9dc902dee24f325fe0f8b6acb /server/middlewares/validators/search.ts | |
parent | fbd67e7f386504e50f2504cb6386700a58906f16 (diff) | |
download | PeerTube-b033851fb54241bb703f86add025229e68cc6f59.tar.gz PeerTube-b033851fb54241bb703f86add025229e68cc6f59.tar.zst PeerTube-b033851fb54241bb703f86add025229e68cc6f59.zip |
Search channels against handles and not names
Diffstat (limited to 'server/middlewares/validators/search.ts')
-rw-r--r-- | server/middlewares/validators/search.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/server/middlewares/validators/search.ts b/server/middlewares/validators/search.ts index cde300968..27d0e541d 100644 --- a/server/middlewares/validators/search.ts +++ b/server/middlewares/validators/search.ts | |||
@@ -2,7 +2,7 @@ import * as express from 'express' | |||
2 | import { query } from 'express-validator' | 2 | import { query } from 'express-validator' |
3 | import { isSearchTargetValid } from '@server/helpers/custom-validators/search' | 3 | import { isSearchTargetValid } from '@server/helpers/custom-validators/search' |
4 | import { isHostValid } from '@server/helpers/custom-validators/servers' | 4 | import { isHostValid } from '@server/helpers/custom-validators/servers' |
5 | import { areUUIDsValid, isDateValid, toCompleteUUIDs } from '../../helpers/custom-validators/misc' | 5 | import { areUUIDsValid, isDateValid, isNotEmptyStringArray, toCompleteUUIDs } from '../../helpers/custom-validators/misc' |
6 | import { logger } from '../../helpers/logger' | 6 | import { logger } from '../../helpers/logger' |
7 | import { areValidationErrors } from './shared' | 7 | import { areValidationErrors } from './shared' |
8 | 8 | ||
@@ -64,9 +64,10 @@ const videoChannelsListSearchValidator = [ | |||
64 | .optional() | 64 | .optional() |
65 | .custom(isSearchTargetValid).withMessage('Should have a valid search target'), | 65 | .custom(isSearchTargetValid).withMessage('Should have a valid search target'), |
66 | 66 | ||
67 | query('names') | 67 | query('handles') |
68 | .optional() | 68 | .optional() |
69 | .toArray(), | 69 | .toArray() |
70 | .custom(isNotEmptyStringArray).withMessage('Should have valid handles'), | ||
70 | 71 | ||
71 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 72 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
72 | logger.debug('Checking video channels search query', { parameters: req.query }) | 73 | logger.debug('Checking video channels search query', { parameters: req.query }) |