),
body('name')
.optional()
- .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`
+ ),
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
logger.debug('Checking videoImportAddValidator parameters', { parameters: req.body })
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'),
.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()
.withMessage('Should have a file'),
body('name')
.trim()
- .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('channelId')
.customSanitizer(toIntOrNull)
.custom(isIdValid).withMessage('Should have correct video channel id'),
.withMessage('Should have a valid filename'),
body('name')
.trim()
- .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('channelId')
.customSanitizer(toIntOrNull)
.custom(isIdValid).withMessage('Should have correct video channel id'),
body('name')
.optional()
.trim()
- .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('channelId')
.optional()
.customSanitizer(toIntOrNull)
body('tags')
.optional()
.customSanitizer(toValueOrNull)
- .custom(isVideoTagsValid).withMessage('Should have correct tags'),
+ .custom(isVideoTagsValid)
+ .withMessage(
+ `Should have an array of up to ${CONSTRAINTS_FIELDS.VIDEOS.TAGS.max} tags between ` +
+ `${CONSTRAINTS_FIELDS.VIDEOS.TAG.min} and ${CONSTRAINTS_FIELDS.VIDEOS.TAG.max} characters each`
+ ),
body('commentsEnabled')
.optional()
.customSanitizer(toBooleanOrNull)