aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/customValidators.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/customValidators.js')
-rw-r--r--server/helpers/customValidators.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/server/helpers/customValidators.js b/server/helpers/customValidators.js
index a6cf680e5..4d6139a3d 100644
--- a/server/helpers/customValidators.js
+++ b/server/helpers/customValidators.js
@@ -17,7 +17,8 @@ const customValidators = {
17 isVideoNameValid: isVideoNameValid, 17 isVideoNameValid: isVideoNameValid,
18 isVideoPodUrlValid: isVideoPodUrlValid, 18 isVideoPodUrlValid: isVideoPodUrlValid,
19 isVideoTagsValid: isVideoTagsValid, 19 isVideoTagsValid: isVideoTagsValid,
20 isVideoThumbnailValid: isVideoThumbnailValid 20 isVideoThumbnailValid: isVideoThumbnailValid,
21 isVideoThumbnail64Valid: isVideoThumbnail64Valid
21} 22}
22 23
23function exists (value) { 24function exists (value) {
@@ -37,7 +38,7 @@ function isEachRemoteVideosValid (requests) {
37 isVideoNameValid(video.name) && 38 isVideoNameValid(video.name) &&
38 isVideoPodUrlValid(video.podUrl) && 39 isVideoPodUrlValid(video.podUrl) &&
39 isVideoTagsValid(video.tags) && 40 isVideoTagsValid(video.tags) &&
40 isVideoThumbnailValid(video.thumbnailBase64) 41 isVideoThumbnail64Valid(video.thumbnailBase64)
41 ) || 42 ) ||
42 ( 43 (
43 isRequestTypeRemoveValid(request.type) && 44 isRequestTypeRemoveValid(request.type) &&
@@ -97,8 +98,12 @@ function isVideoTagsValid (tags) {
97} 98}
98 99
99function isVideoThumbnailValid (value) { 100function isVideoThumbnailValid (value) {
101 return validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.THUMBNAIL)
102}
103
104function isVideoThumbnail64Valid (value) {
100 return validator.isBase64(value) && 105 return validator.isBase64(value) &&
101 validator.isByteLength(value, VIDEOS_CONSTRAINTS_FIELDS.THUMBNAIL) 106 validator.isByteLength(value, VIDEOS_CONSTRAINTS_FIELDS.THUMBNAIL64)
102} 107}
103 108
104// --------------------------------------------------------------------------- 109// ---------------------------------------------------------------------------