X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fcustom-validators%2Fvideos.js;h=8495e9665965d3b9a759c6d2b09f1829a43e38ad;hb=6f0c39e2de400685b7baf8340b9e132f2659365a;hp=648c7540bf33a7b1582f0a6318f192fe12e969cf;hpb=d38b82810638b9f664c9016fac2684454c273a77;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/custom-validators/videos.js b/server/helpers/custom-validators/videos.js index 648c7540b..8495e9665 100644 --- a/server/helpers/custom-validators/videos.js +++ b/server/helpers/custom-validators/videos.js @@ -13,6 +13,8 @@ const VIDEO_EVENTS_CONSTRAINTS_FIELDS = constants.CONSTRAINTS_FIELDS.VIDEO_EVENT const videosValidators = { isVideoAuthorValid, isVideoDateValid, + isVideoCategoryValid, + isVideoLicenceValid, isVideoDescriptionValid, isVideoDurationValid, isVideoInfoHashValid, @@ -40,6 +42,14 @@ function isVideoDateValid (value) { return validator.isDate(value) } +function isVideoCategoryValid (value) { + return constants.VIDEO_CATEGORIES[value] !== undefined +} + +function isVideoLicenceValid (value) { + return constants.VIDEO_LICENCES[value] !== undefined +} + function isVideoDescriptionValid (value) { return validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.DESCRIPTION) } @@ -64,8 +74,7 @@ function isVideoTagsValid (tags) { return miscValidators.isArray(tags) && validator.isInt(tags.length, VIDEOS_CONSTRAINTS_FIELDS.TAGS) && tags.every(function (tag) { - return validator.isAlphanumeric(tag) && - validator.isLength(tag, VIDEOS_CONSTRAINTS_FIELDS.TAG) + return validator.isLength(tag, VIDEOS_CONSTRAINTS_FIELDS.TAG) }) }