1 import 'express-validator'
2 import * as express from 'express'
3 import { getHostWithPort } from '../helpers'
5 import { REMOTE_SCHEME } from '../initializers'
7 function setBodyHostsPort (req: express.Request, res: express.Response, next: express.NextFunction) {
8 if (!req.body.hosts) return next()
10 for (let i = 0; i < req.body.hosts.length; i++) {
11 const hostWithPort = getHostWithPort(req.body.hosts[i])
13 // Problem with the url parsing?
14 if (hostWithPort === null) {
15 return res.sendStatus(500)
18 req.body.hosts[i] = hostWithPort
24 // ---------------------------------------------------------------------------