X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fvalidators%2Fabuse.ts;h=22f66c8cff0d0ab69eaf822c98cf6aff3b867a00;hb=743dab5517d4501f6b35cfc795de6c8b6f41ebb3;hp=56c97747cefa7a810f6ef8b33a71152eefafccea;hpb=10363c74c1d869f0e0c7bc4d0367b1f34d1bb6a4;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/validators/abuse.ts b/server/middlewares/validators/abuse.ts index 56c97747c..22f66c8cf 100644 --- a/server/middlewares/validators/abuse.ts +++ b/server/middlewares/validators/abuse.ts @@ -1,4 +1,4 @@ -import * as express from 'express' +import express from 'express' import { body, param, query } from 'express-validator' import { areAbusePredefinedReasonsValid, @@ -12,11 +12,11 @@ import { isAbuseTimestampValid, isAbuseVideoIsValid } from '@server/helpers/custom-validators/abuses' -import { exists, isIdOrUUIDValid, isIdValid, toIntOrNull } from '@server/helpers/custom-validators/misc' +import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID, toIntOrNull } from '@server/helpers/custom-validators/misc' import { logger } from '@server/helpers/logger' import { AbuseMessageModel } from '@server/models/abuse/abuse-message' import { AbuseCreate, UserRight } from '@shared/models' -import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' +import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' import { areValidationErrors, doesAbuseExist, doesAccountIdExist, doesCommentIdExist, doesVideoExist } from './shared' const abuseReportValidator = [ @@ -27,6 +27,7 @@ const abuseReportValidator = [ body('video.id') .optional() + .customSanitizer(toCompleteUUID) .custom(isIdOrUUIDValid) .withMessage('Should have a valid videoId'), body('video.startAt')