From 0221f8c9b174c1c95b7348215f0d652bb1899c6b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 25 Feb 2021 10:01:33 +0100 Subject: Trim video name also on server --- server/middlewares/validators/videos/videos.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'server/middlewares/validators/videos/videos.ts') diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts index 26a671a1e..be05b2a69 100644 --- a/server/middlewares/validators/videos/videos.ts +++ b/server/middlewares/validators/videos/videos.ts @@ -62,6 +62,7 @@ const videosAddValidator = getCommonVideoEditAttributes().concat([ .custom((value, { req }) => isFileFieldValid(req.files, 'videofile')) .withMessage('Should have a file'), body('name') + .trim() .custom(isVideoNameValid) .withMessage('Should have a valid name'), body('channelId') @@ -129,6 +130,7 @@ const videosUpdateValidator = getCommonVideoEditAttributes().concat([ param('id').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid id'), body('name') .optional() + .trim() .custom(isVideoNameValid).withMessage('Should have a valid name'), body('channelId') .optional() -- cgit v1.2.3