aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/pods.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-01-27 11:55:31 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-01-27 11:55:31 +0100
commitb09ce6455f8e2bf9dd741532e6ad09309880ff74 (patch)
tree7d2ec942e50b8f3347ed4287e07e2bc88619e585 /server/middlewares/pods.js
parent0d4fb7e6d482635cd725cd2f09cf981f82cbd92c (diff)
downloadPeerTube-b09ce6455f8e2bf9dd741532e6ad09309880ff74.tar.gz
PeerTube-b09ce6455f8e2bf9dd741532e6ad09309880ff74.tar.zst
PeerTube-b09ce6455f8e2bf9dd741532e6ad09309880ff74.zip
Server: error if we add a pod that already exists
Diffstat (limited to 'server/middlewares/pods.js')
-rw-r--r--server/middlewares/pods.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/server/middlewares/pods.js b/server/middlewares/pods.js
index e38fb341d..2647f9ff0 100644
--- a/server/middlewares/pods.js
+++ b/server/middlewares/pods.js
@@ -8,6 +8,8 @@ const podsMiddleware = {
8} 8}
9 9
10function setBodyHostsPort (req, res, next) { 10function setBodyHostsPort (req, res, next) {
11 if (!req.body.hosts) return next()
12
11 for (let i = 0; i < req.body.hosts.length; i++) { 13 for (let i = 0; i < req.body.hosts.length; i++) {
12 const hostWithPort = getHostWithPort(req.body.hosts[i]) 14 const hostWithPort = getHostWithPort(req.body.hosts[i])
13 15
@@ -23,6 +25,8 @@ function setBodyHostsPort (req, res, next) {
23} 25}
24 26
25function setBodyHostPort (req, res, next) { 27function setBodyHostPort (req, res, next) {
28 if (!req.body.host) return next()
29
26 const hostWithPort = getHostWithPort(req.body.host) 30 const hostWithPort = getHostWithPort(req.body.host)
27 31
28 // Problem with the url parsing? 32 // Problem with the url parsing?