X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fvalidators%2Fusers.ts;h=698d7d814b7a7daf72c592be9f26c133c5356561;hb=d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb;hp=0eb9172c4158bd5ca3b0914f7fac00980e9856ea;hpb=76148b27f7501bac061992136852be4303370c8d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts index 0eb9172c4..698d7d814 100644 --- a/server/middlewares/validators/users.ts +++ b/server/middlewares/validators/users.ts @@ -7,7 +7,7 @@ import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-code import { UserRole } from '../../../shared/models/users' import { UserRegister } from '../../../shared/models/users/user-register.model' import { isActorPreferredUsernameValid } from '../../helpers/custom-validators/activitypub/actor' -import { isIdOrUUIDValid, toBooleanOrNull, toIntOrNull } from '../../helpers/custom-validators/misc' +import { toBooleanOrNull, toIntOrNull } from '../../helpers/custom-validators/misc' import { isThemeNameValid } from '../../helpers/custom-validators/plugins' import { isNoInstanceConfigWarningModal, @@ -30,13 +30,12 @@ import { } from '../../helpers/custom-validators/users' import { isVideoChannelNameValid } from '../../helpers/custom-validators/video-channels' import { logger } from '../../helpers/logger' -import { doesVideoExist } from '../../helpers/middlewares' -import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup' import { isThemeRegistered } from '../../lib/plugins/theme-utils' import { Redis } from '../../lib/redis' -import { UserModel } from '../../models/user/user' +import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../lib/signup' import { ActorModel } from '../../models/actor/actor' -import { areValidationErrors } from './utils' +import { UserModel } from '../../models/user/user' +import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from './shared' const usersListValidator = [ query('blocked') @@ -303,7 +302,7 @@ const usersGetValidator = [ ] const usersVideoRatingValidator = [ - param('videoId').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid video id'), + isValidVideoIdParam('videoId'), async (req: express.Request, res: express.Response, next: express.NextFunction) => { logger.debug('Checking usersVideoRating parameters', { parameters: req.params })