X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fcustom-validators%2Fpods.js;h=0154a242432b1bf43b6bc35ab94bb105864f82e8;hb=49abbbbedca83b9031d3e2eb3ae9ad9b6a7d96ed;hp=28d04a05dc02ac2923bca5b2e3c5c9701f663bbf;hpb=d57d6f2605f4ac4a81f9a8594433bb7b65f108b9;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/custom-validators/pods.js b/server/helpers/custom-validators/pods.js index 28d04a05d..0154a2424 100644 --- a/server/helpers/custom-validators/pods.js +++ b/server/helpers/custom-validators/pods.js @@ -5,14 +5,14 @@ const validator = require('express-validator').validator const miscValidators = require('./misc') const podsValidators = { - isEachUniqueUrlValid: isEachUniqueUrlValid + isEachUniqueHostValid } -function isEachUniqueUrlValid (urls) { - return miscValidators.isArray(urls) && - urls.length !== 0 && - urls.every(function (url) { - return validator.isURL(url) && urls.indexOf(url) === urls.lastIndexOf(url) +function isEachUniqueHostValid (hosts) { + return miscValidators.isArray(hosts) && + hosts.length !== 0 && + hosts.every(function (host) { + return validator.isURL(host) && host.split('://').length === 1 && hosts.indexOf(host) === hosts.lastIndexOf(host) }) }