From 67100f1f971dd10a466a321899b56c0813e08d31 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 16 May 2016 19:49:10 +0200 Subject: Add a check for the duration of videos --- server/helpers/customValidators.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'server/helpers') 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 @@ const validator = require('validator') +const constants = require('../initializers/constants') + const customValidators = { eachIsRemoteVideosAddValid: eachIsRemoteVideosAddValid, eachIsRemoteVideosRemoveValid: eachIsRemoteVideosRemoveValid, @@ -15,6 +17,8 @@ function eachIsRemoteVideosAddValid (values) { validator.isLength(val.magnetUri, 10) && validator.isURL(val.podUrl) && !isNaN(val.duration) && + val.duration >= 0 && + val.duration < constants.MAXIMUM_VIDEO_DURATION && validator.isDate(val.createdDate) }) } -- cgit v1.2.3