1
0
Fork 0

Fix origin computation

pull/8257/head
Jordi Boggiano 2019-07-31 18:01:08 +02:00
parent 0261ce8092
commit 0fe200d6d9
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 9 additions and 2 deletions

View File

@ -495,13 +495,20 @@ class GitLabDriver extends VcsDriver
private static function determineOrigin(array $configuredDomains, $guessedDomain, array &$urlParts, $portNumber) private static function determineOrigin(array $configuredDomains, $guessedDomain, array &$urlParts, $portNumber)
{ {
if (in_array($guessedDomain, $configuredDomains) || ($portNumber && in_array($guessedDomain.':'.$portNumber, $configuredDomains))) { if (in_array($guessedDomain, $configuredDomains) || ($portNumber && in_array($guessedDomain.':'.$portNumber, $configuredDomains))) {
if ($portNumber) {
return $guessedDomain.':'.$portNumber;
}
return $guessedDomain; return $guessedDomain;
} }
if ($portNumber) {
$guessedDomain .= ':'.$portNumber;
}
while (null !== ($part = array_shift($urlParts))) { while (null !== ($part = array_shift($urlParts))) {
$guessedDomain .= '/' . $part; $guessedDomain .= '/' . $part;
if (in_array($guessedDomain, $configuredDomains) || ($portNumber && in_array(preg_replace('{/}', ':'.$portNumber.'/', $guessedDomain, 1), $configuredDomains))) { if (in_array($guessedDomain, $configuredDomains) || ($portNumber && in_array(preg_replace('{:\d+}', '', $guessedDomain), $configuredDomains))) {
return $guessedDomain; return $guessedDomain;
} }
} }

View File

@ -207,7 +207,7 @@ JSON;
JSON; JSON;
$this->remoteFilesystem $this->remoteFilesystem
->getContents($domain, $apiUrl, false, array()) ->getContents($domain.':'.$port, $apiUrl, false, array())
->willReturn(sprintf($projectData, $domain, $port, $namespace)) ->willReturn(sprintf($projectData, $domain, $port, $namespace))
->shouldBeCalledTimes(1); ->shouldBeCalledTimes(1);