aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-08-21 09:54:46 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-08-21 09:54:46 +0200
commit6c1a098b4107cc923631d8cd94ed54c184fcec7d (patch)
treea7528c8dfb92aefbb50542c8e4bf267df9e695d7
parent4613274479968f58f62c63178c92c1391de84297 (diff)
downloadPeerTube-6c1a098b4107cc923631d8cd94ed54c184fcec7d.tar.gz
PeerTube-6c1a098b4107cc923631d8cd94ed54c184fcec7d.tar.zst
PeerTube-6c1a098b4107cc923631d8cd94ed54c184fcec7d.zip
Server: fix remote videos requests validator
-rw-r--r--server/helpers/custom-validators/videos.js41
-rw-r--r--server/middlewares/validators/remote.js1
2 files changed, 21 insertions, 21 deletions
diff --git a/server/helpers/custom-validators/videos.js b/server/helpers/custom-validators/videos.js
index cffa973f8..ebe927208 100644
--- a/server/helpers/custom-validators/videos.js
+++ b/server/helpers/custom-validators/videos.js
@@ -22,26 +22,27 @@ const videosValidators = {
22} 22}
23 23
24function isEachRemoteVideosValid (requests) { 24function isEachRemoteVideosValid (requests) {
25 return requests.every(function (request) { 25 return miscValidators.isArray(requests) &&
26 const video = request.data 26 requests.every(function (request) {
27 return ( 27 const video = request.data
28 isRequestTypeAddValid(request.type) && 28 return (
29 isVideoAuthorValid(video.author) && 29 isRequestTypeAddValid(request.type) &&
30 isVideoDateValid(video.createdDate) && 30 isVideoAuthorValid(video.author) &&
31 isVideoDescriptionValid(video.description) && 31 isVideoDateValid(video.createdDate) &&
32 isVideoDurationValid(video.duration) && 32 isVideoDescriptionValid(video.description) &&
33 isVideoMagnetUriValid(video.magnetUri) && 33 isVideoDurationValid(video.duration) &&
34 isVideoNameValid(video.name) && 34 isVideoMagnetUriValid(video.magnetUri) &&
35 isVideoPodUrlValid(video.podUrl) && 35 isVideoNameValid(video.name) &&
36 isVideoTagsValid(video.tags) && 36 isVideoPodUrlValid(video.podUrl) &&
37 isVideoThumbnail64Valid(video.thumbnailBase64) 37 isVideoTagsValid(video.tags) &&
38 ) || 38 isVideoThumbnail64Valid(video.thumbnailBase64)
39 ( 39 ) ||
40 isRequestTypeRemoveValid(request.type) && 40 (
41 isVideoNameValid(video.name) && 41 isRequestTypeRemoveValid(request.type) &&
42 isVideoMagnetUriValid(video.magnetUri) 42 isVideoNameValid(video.name) &&
43 ) 43 isVideoMagnetUriValid(video.magnetUri)
44 }) 44 )
45 })
45} 46}
46 47
47function isVideoAuthorValid (value) { 48function isVideoAuthorValid (value) {
diff --git a/server/middlewares/validators/remote.js b/server/middlewares/validators/remote.js
index 1be119458..87dc524a2 100644
--- a/server/middlewares/validators/remote.js
+++ b/server/middlewares/validators/remote.js
@@ -19,7 +19,6 @@ function dataToDecrypt (req, res, next) {
19} 19}
20 20
21function remoteVideos (req, res, next) { 21function remoteVideos (req, res, next) {
22 req.checkBody('data').isArray()
23 req.checkBody('data').isEachRemoteVideosValid() 22 req.checkBody('data').isEachRemoteVideosValid()
24 23
25 logger.debug('Checking remoteVideos parameters', { parameters: req.body }) 24 logger.debug('Checking remoteVideos parameters', { parameters: req.body })