diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-05-16 19:49:10 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-05-16 19:49:10 +0200 |
commit | 67100f1f971dd10a466a321899b56c0813e08d31 (patch) | |
tree | 3253db23a9dca2273fd2c9702fb3b6f1801c0f1c /server/helpers/customValidators.js | |
parent | dcc7b3fe470fe5f1546c0f3e7c28c07fc54633c5 (diff) | |
download | PeerTube-67100f1f971dd10a466a321899b56c0813e08d31.tar.gz PeerTube-67100f1f971dd10a466a321899b56c0813e08d31.tar.zst PeerTube-67100f1f971dd10a466a321899b56c0813e08d31.zip |
Add a check for the duration of videos
Diffstat (limited to 'server/helpers/customValidators.js')
-rw-r--r-- | server/helpers/customValidators.js | 4 |
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 | ||
3 | const validator = require('validator') | 3 | const validator = require('validator') |
4 | 4 | ||
5 | const constants = require('../initializers/constants') | ||
6 | |||
5 | const customValidators = { | 7 | const 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 | } |