diff options
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/validators/search.ts | 5 |
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' | |||
2 | import { areValidationErrors } from './utils' | 2 | import { areValidationErrors } from './utils' |
3 | import { logger } from '../../helpers/logger' | 3 | import { logger } from '../../helpers/logger' |
4 | import { query } from 'express-validator/check' | 4 | import { query } from 'express-validator/check' |
5 | import { isNumberArray, isStringArray } from '../../helpers/custom-validators/search' | 5 | import { isNumberArray, isStringArray, isNSFWQueryValid } from '../../helpers/custom-validators/search' |
6 | import { isBooleanValid, isDateValid, toArray } from '../../helpers/custom-validators/misc' | 6 | import { isBooleanValid, isDateValid, toArray } from '../../helpers/custom-validators/misc' |
7 | 7 | ||
8 | const searchValidator = [ | 8 | const 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 }) |