]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/videos/video-live.ts
improve api param message for video names and tags
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / videos / video-live.ts
index 3a73e12725b1b13fd5b684d712d6a04c36875f99..ec4c7f32f4624de8beba7762c6cf1efe87163e6c 100644 (file)
@@ -14,6 +14,7 @@ import { VideoModel } from '@server/models/video/video'
 import { Hooks } from '@server/lib/plugins/hooks'
 import { isLocalLiveVideoAccepted } from '@server/lib/moderation'
 import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
+import { CONSTRAINTS_FIELDS } from '@server/initializers/constants'
 
 const videoLiveGetValidator = [
   param('videoId').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid videoId'),
@@ -43,7 +44,9 @@ const videoLiveAddValidator = getCommonVideoEditAttributes().concat([
     .custom(isIdValid).withMessage('Should have correct video channel id'),
 
   body('name')
-    .custom(isVideoNameValid).withMessage('Should have a valid name'),
+    .custom(isVideoNameValid).withMessage(
+      `Should have a video name between ${CONSTRAINTS_FIELDS.VIDEOS.NAME.min} and ${CONSTRAINTS_FIELDS.VIDEOS.NAME.max} characters long`
+    ),
 
   body('saveReplay')
     .optional()