1
0
Fork 0

Make gitlab/bitbucket driver checks case insensitive

pull/8360/head
Jordi Boggiano 2019-10-06 21:27:33 +02:00
parent 34a32c31b4
commit 9e2485aa4d
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
5 changed files with 7 additions and 5 deletions

View File

@ -46,7 +46,7 @@ abstract class BitbucketDriver extends VcsDriver
*/
public function initialize()
{
preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)$#', $this->url, $match);
preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)$#i', $this->url, $match);
$this->owner = $match[1];
$this->repository = $match[2];
$this->originUrl = 'bitbucket.org';

View File

@ -53,7 +53,7 @@ class GitBitbucketDriver extends BitbucketDriver
*/
public static function supports(IOInterface $io, Config $config, $url, $deep = false)
{
if (!preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)\.git$#', $url)) {
if (!preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)\.git$#i', $url)) {
return false;
}

View File

@ -50,7 +50,7 @@ class GitHubDriver extends VcsDriver
preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match);
$this->owner = $match[3];
$this->repository = $match[4];
$this->originUrl = !empty($match[1]) ? $match[1] : $match[2];
$this->originUrl = strtolower(!empty($match[1]) ? $match[1] : $match[2]);
if ($this->originUrl === 'www.github.com') {
$this->originUrl = 'github.com';
}
@ -272,7 +272,7 @@ class GitHubDriver extends VcsDriver
}
$originUrl = !empty($matches[2]) ? $matches[2] : $matches[3];
if (!in_array(preg_replace('{^www\.}i', '', $originUrl), $config->get('github-domains'))) {
if (!in_array(strtolower(preg_replace('{^www\.}i', '', $originUrl)), $config->get('github-domains'))) {
return false;
}

View File

@ -494,6 +494,8 @@ class GitLabDriver extends VcsDriver
*/
private static function determineOrigin(array $configuredDomains, $guessedDomain, array &$urlParts, $portNumber)
{
$guessedDomain = strtolower($guessedDomain);
if (in_array($guessedDomain, $configuredDomains) || ($portNumber && in_array($guessedDomain.':'.$portNumber, $configuredDomains))) {
if ($portNumber) {
return $guessedDomain.':'.$portNumber;

View File

@ -53,7 +53,7 @@ class HgBitbucketDriver extends BitbucketDriver
*/
public static function supports(IOInterface $io, Config $config, $url, $deep = false)
{
if (!preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#', $url)) {
if (!preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#i', $url)) {
return false;
}