]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/pods.js
Use yarn instead of npm install
[github/Chocobozzz/PeerTube.git] / server / middlewares / pods.js
index 487ea1259e6a403a149e5fb28a5a40d6671b9db5..2647f9ff0b342849007fbca19cfcb552b72ee339 100644 (file)
@@ -8,6 +8,8 @@ const podsMiddleware = {
 }
 
 function setBodyHostsPort (req, res, next) {
+  if (!req.body.hosts) return next()
+
   for (let i = 0; i < req.body.hosts.length; i++) {
     const hostWithPort = getHostWithPort(req.body.hosts[i])
 
@@ -23,6 +25,8 @@ function setBodyHostsPort (req, res, next) {
 }
 
 function setBodyHostPort (req, res, next) {
+  if (!req.body.host) return next()
+
   const hostWithPort = getHostWithPort(req.body.host)
 
   // Problem with the url parsing?
@@ -44,7 +48,6 @@ module.exports = podsMiddleware
 function getHostWithPort (host) {
   const splitted = host.split(':')
 
-  console.log(splitted)
   // The port was not specified
   if (splitted.length === 1) {
     if (constants.REMOTE_SCHEME.HTTP === 'https') return host + ':443'