aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r--server/middlewares/validators/search.ts5
1 files changed, 2 insertions, 3 deletions
diff --git a/server/middlewares/validators/search.ts b/server/middlewares/validators/search.ts
index fb2148eb3..a97f5b581 100644
--- a/server/middlewares/validators/search.ts
+++ b/server/middlewares/validators/search.ts
@@ -2,7 +2,7 @@ import * as express from 'express'
2import { areValidationErrors } from './utils' 2import { areValidationErrors } from './utils'
3import { logger } from '../../helpers/logger' 3import { logger } from '../../helpers/logger'
4import { query } from 'express-validator/check' 4import { query } from 'express-validator/check'
5import { isNumberArray, isStringArray } from '../../helpers/custom-validators/search' 5import { isNumberArray, isStringArray, isNSFWQueryValid } from '../../helpers/custom-validators/search'
6import { isBooleanValid, isDateValid, toArray } from '../../helpers/custom-validators/misc' 6import { isBooleanValid, isDateValid, toArray } from '../../helpers/custom-validators/misc'
7 7
8const searchValidator = [ 8const searchValidator = [
@@ -46,8 +46,7 @@ const commonVideosFiltersValidator = [
46 .custom(isStringArray).withMessage('Should have a valid all of tags array'), 46 .custom(isStringArray).withMessage('Should have a valid all of tags array'),
47 query('nsfw') 47 query('nsfw')
48 .optional() 48 .optional()
49 .toBoolean() 49 .custom(isNSFWQueryValid).withMessage('Should have a valid NSFW attribute'),
50 .custom(isBooleanValid).withMessage('Should have a valid NSFW attribute'),
51 50
52 (req: express.Request, res: express.Response, next: express.NextFunction) => { 51 (req: express.Request, res: express.Response, next: express.NextFunction) => {
53 logger.debug('Checking commons video filters query', { parameters: req.query }) 52 logger.debug('Checking commons video filters query', { parameters: req.query })