aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-05-16 19:49:10 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-05-16 19:49:10 +0200
commit67100f1f971dd10a466a321899b56c0813e08d31 (patch)
tree3253db23a9dca2273fd2c9702fb3b6f1801c0f1c /server/helpers
parentdcc7b3fe470fe5f1546c0f3e7c28c07fc54633c5 (diff)
downloadPeerTube-67100f1f971dd10a466a321899b56c0813e08d31.tar.gz
PeerTube-67100f1f971dd10a466a321899b56c0813e08d31.tar.zst
PeerTube-67100f1f971dd10a466a321899b56c0813e08d31.zip
Add a check for the duration of videos
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/customValidators.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/server/helpers/customValidators.js b/server/helpers/customValidators.js
index a8fc6942d..9b982369e 100644
--- a/server/helpers/customValidators.js
+++ b/server/helpers/customValidators.js
@@ -2,6 +2,8 @@
2 2
3const validator = require('validator') 3const validator = require('validator')
4 4
5const constants = require('../initializers/constants')
6
5const customValidators = { 7const customValidators = {
6 eachIsRemoteVideosAddValid: eachIsRemoteVideosAddValid, 8 eachIsRemoteVideosAddValid: eachIsRemoteVideosAddValid,
7 eachIsRemoteVideosRemoveValid: eachIsRemoteVideosRemoveValid, 9 eachIsRemoteVideosRemoveValid: eachIsRemoteVideosRemoveValid,
@@ -15,6 +17,8 @@ function eachIsRemoteVideosAddValid (values) {
15 validator.isLength(val.magnetUri, 10) && 17 validator.isLength(val.magnetUri, 10) &&
16 validator.isURL(val.podUrl) && 18 validator.isURL(val.podUrl) &&
17 !isNaN(val.duration) && 19 !isNaN(val.duration) &&
20 val.duration >= 0 &&
21 val.duration < constants.MAXIMUM_VIDEO_DURATION &&
18 validator.isDate(val.createdDate) 22 validator.isDate(val.createdDate)
19 }) 23 })
20} 24}