1
0
Fork 0

Allow for leading slash in path part of GitHub URLs

pull/8310/head
Grey Baker 2019-09-02 22:26:35 +01:00
parent f0d565bb6d
commit b09945c3ba
1 changed files with 2 additions and 2 deletions

View File

@ -47,7 +47,7 @@ class GitHubDriver extends VcsDriver
*/ */
public function initialize() public function initialize()
{ {
preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match); preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match);
$this->owner = $match[3]; $this->owner = $match[3];
$this->repository = $match[4]; $this->repository = $match[4];
$this->originUrl = !empty($match[1]) ? $match[1] : $match[2]; $this->originUrl = !empty($match[1]) ? $match[1] : $match[2];
@ -267,7 +267,7 @@ class GitHubDriver extends VcsDriver
*/ */
public static function supports(IOInterface $io, Config $config, $url, $deep = false) public static function supports(IOInterface $io, Config $config, $url, $deep = false)
{ {
if (!preg_match('#^((?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $url, $matches)) { if (!preg_match('#^((?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/(.+?)(?:\.git|/)?$#', $url, $matches)) {
return false; return false;
} }