diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-01-27 11:55:31 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-01-27 11:55:31 +0100 |
commit | b09ce6455f8e2bf9dd741532e6ad09309880ff74 (patch) | |
tree | 7d2ec942e50b8f3347ed4287e07e2bc88619e585 /server/middlewares/pods.js | |
parent | 0d4fb7e6d482635cd725cd2f09cf981f82cbd92c (diff) | |
download | PeerTube-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.js | 4 |
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 | ||
10 | function setBodyHostsPort (req, res, next) { | 10 | function 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 | ||
25 | function setBodyHostPort (req, res, next) { | 27 | function 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? |