Properly handling Gitlab URLs that contain ports.
Fixes #484, closes #501
This commit is contained in:
parent
5c600f861e
commit
0e1fe3ea22
|
@ -61,7 +61,17 @@ class GitlabBuild extends RemoteGitBuild
|
|||
if (!empty($key)) {
|
||||
$user = $this->getProject()->getAccessInformation("user");
|
||||
$domain = $this->getProject()->getAccessInformation("domain");
|
||||
return $user . '@' . $domain . ':' . $this->getProject()->getReference() . '.git';
|
||||
$port = $this->getProject()->getAccessInformation('port');
|
||||
|
||||
$url = $user . '@' . $domain . ':';
|
||||
|
||||
if (!empty($port)) {
|
||||
$url .= $port . '/';
|
||||
}
|
||||
|
||||
$url .= $this->getProject()->getReference() . '.git';
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,13 +107,18 @@ class ProjectService
|
|||
$matches = array();
|
||||
$reference = $project->getReference();
|
||||
|
||||
if ($project->getType() == 'gitlab' && preg_match('`^(.*)@(.*):(.*)/(.*)\.git`', $reference, $matches)) {
|
||||
if ($project->getType() == 'gitlab') {
|
||||
$info = array();
|
||||
$info['user'] = $matches[1];
|
||||
$info['domain'] = $matches[2];
|
||||
|
||||
if (preg_match('`^(.*)@(.*):([0-9]+)?/?(.*)/(.*)\.git`', $reference, $matches)) {
|
||||
$info['user'] = $matches[1];
|
||||
$info['domain'] = $matches[2];
|
||||
$info['port'] = $matches[3];
|
||||
|
||||
$project->setReference($matches[4] . '/' . $matches[5]);
|
||||
}
|
||||
|
||||
$project->setAccessInformation($info);
|
||||
$project->setReference($matches[3] . '/' . $matches[4]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue