Feature: Allow local directory paths in repository of type composer (#11526)
Fixes: #11519pull/11557/head
parent
69746f699f
commit
68b7a07187
|
@ -139,9 +139,14 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
if (!Preg::isMatch('{^[\w.]+\??://}', $repoConfig['url'])) {
|
if (!Preg::isMatch('{^[\w.]+\??://}', $repoConfig['url'])) {
|
||||||
// assume http as the default protocol
|
if (($localFilePath = realpath($repoConfig['url'])) !== false) {
|
||||||
|
// it is a local path, add file scheme
|
||||||
|
$repoConfig['url'] = 'file://'.$localFilePath;
|
||||||
|
} else {
|
||||||
|
// otherwise, assume http as the default protocol
|
||||||
$repoConfig['url'] = 'http://'.$repoConfig['url'];
|
$repoConfig['url'] = 'http://'.$repoConfig['url'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$repoConfig['url'] = rtrim($repoConfig['url'], '/');
|
$repoConfig['url'] = rtrim($repoConfig['url'], '/');
|
||||||
if ($repoConfig['url'] === '') {
|
if ($repoConfig['url'] === '') {
|
||||||
throw new \InvalidArgumentException('The repository url must not be an empty string');
|
throw new \InvalidArgumentException('The repository url must not be an empty string');
|
||||||
|
|
Loading…
Reference in New Issue