aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/videos.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators/videos.js')
-rw-r--r--server/helpers/custom-validators/videos.js19
1 files changed, 12 insertions, 7 deletions
diff --git a/server/helpers/custom-validators/videos.js b/server/helpers/custom-validators/videos.js
index 1a7753265..be8256a80 100644
--- a/server/helpers/custom-validators/videos.js
+++ b/server/helpers/custom-validators/videos.js
@@ -13,7 +13,7 @@ const videosValidators = {
13 isVideoDateValid, 13 isVideoDateValid,
14 isVideoDescriptionValid, 14 isVideoDescriptionValid,
15 isVideoDurationValid, 15 isVideoDurationValid,
16 isVideoMagnetValid, 16 isVideoInfoHashValid,
17 isVideoNameValid, 17 isVideoNameValid,
18 isVideoPodHostValid, 18 isVideoPodHostValid,
19 isVideoTagsValid, 19 isVideoTagsValid,
@@ -28,14 +28,15 @@ function isEachRemoteVideosValid (requests) {
28 return ( 28 return (
29 isRequestTypeAddValid(request.type) && 29 isRequestTypeAddValid(request.type) &&
30 isVideoAuthorValid(video.author) && 30 isVideoAuthorValid(video.author) &&
31 isVideoDateValid(video.createdDate) && 31 isVideoDateValid(video.createdAt) &&
32 isVideoDescriptionValid(video.description) && 32 isVideoDescriptionValid(video.description) &&
33 isVideoDurationValid(video.duration) && 33 isVideoDurationValid(video.duration) &&
34 isVideoMagnetValid(video.magnet) && 34 isVideoInfoHashValid(video.infoHash) &&
35 isVideoNameValid(video.name) && 35 isVideoNameValid(video.name) &&
36 isVideoTagsValid(video.tags) && 36 isVideoTagsValid(video.tags) &&
37 isVideoThumbnail64Valid(video.thumbnailBase64) && 37 isVideoThumbnail64Valid(video.thumbnailBase64) &&
38 isVideoRemoteIdValid(video.remoteId) 38 isVideoRemoteIdValid(video.remoteId) &&
39 isVideoExtnameValid(video.extname)
39 ) || 40 ) ||
40 ( 41 (
41 isRequestTypeRemoveValid(request.type) && 42 isRequestTypeRemoveValid(request.type) &&
@@ -61,8 +62,12 @@ function isVideoDurationValid (value) {
61 return validator.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.DURATION) 62 return validator.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.DURATION)
62} 63}
63 64
64function isVideoMagnetValid (value) { 65function isVideoExtnameValid (value) {
65 return validator.isLength(value.infoHash, VIDEOS_CONSTRAINTS_FIELDS.MAGNET.INFO_HASH) 66 return VIDEOS_CONSTRAINTS_FIELDS.EXTNAME.indexOf(value) !== -1
67}
68
69function isVideoInfoHashValid (value) {
70 return validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.INFO_HASH)
66} 71}
67 72
68function isVideoNameValid (value) { 73function isVideoNameValid (value) {
@@ -93,7 +98,7 @@ function isVideoThumbnail64Valid (value) {
93} 98}
94 99
95function isVideoRemoteIdValid (value) { 100function isVideoRemoteIdValid (value) {
96 return validator.isMongoId(value) 101 return validator.isUUID(value, 4)
97} 102}
98 103
99// --------------------------------------------------------------------------- 104// ---------------------------------------------------------------------------