X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fvalidators%2Flogs.ts;h=901d8ca64f684032b7be6ba3de65b12419d01c9d;hb=082d32eb8873190e48329b61b91f87d71f3cf812;hp=c55baaee385f69bd62c6652f4286c7ab4ca3dbe3;hpb=cf21b2cbef61929177b9c09b5e017c3b7eb8535d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/validators/logs.ts b/server/middlewares/validators/logs.ts index c55baaee3..901d8ca64 100644 --- a/server/middlewares/validators/logs.ts +++ b/server/middlewares/validators/logs.ts @@ -1,7 +1,8 @@ -import * as express from 'express' +import express from 'express' import { query } from 'express-validator' +import { isStringArray } from '@server/helpers/custom-validators/search' import { isValidLogLevel } from '../../helpers/custom-validators/logs' -import { isDateValid } from '../../helpers/custom-validators/misc' +import { isDateValid, toArray } from '../../helpers/custom-validators/misc' import { logger } from '../../helpers/logger' import { areValidationErrors } from './shared' @@ -11,6 +12,10 @@ const getLogsValidator = [ query('level') .optional() .custom(isValidLogLevel).withMessage('Should have a valid level'), + query('tagsOneOf') + .optional() + .customSanitizer(toArray) + .custom(isStringArray).withMessage('Should have a valid one of tags array'), query('endDate') .optional() .custom(isDateValid).withMessage('Should have an end date that conforms to ISO 8601'),