From 3bb191a464b14adebc3269924b771e387fb5958e Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 7 May 2023 13:53:32 +0200 Subject: [PATCH] Add support for env vars and ~ (for HOME) in repo paths for vcs and artifact repositories, fixes #11409 (#11453) --- src/Composer/Repository/ArtifactRepository.php | 3 ++- src/Composer/Repository/VcsRepository.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Composer/Repository/ArtifactRepository.php b/src/Composer/Repository/ArtifactRepository.php index 0e7c4cecf..f73f4e9e1 100644 --- a/src/Composer/Repository/ArtifactRepository.php +++ b/src/Composer/Repository/ArtifactRepository.php @@ -17,6 +17,7 @@ use Composer\Json\JsonFile; use Composer\Package\BasePackage; use Composer\Package\Loader\ArrayLoader; use Composer\Package\Loader\LoaderInterface; +use Composer\Util\Platform; use Composer\Util\Tar; use Composer\Util\Zip; @@ -46,7 +47,7 @@ class ArtifactRepository extends ArrayRepository implements ConfigurableReposito } $this->loader = new ArrayLoader(); - $this->lookup = $repoConfig['url']; + $this->lookup = Platform::expandPath($repoConfig['url']); $this->io = $io; $this->repoConfig = $repoConfig; } diff --git a/src/Composer/Repository/VcsRepository.php b/src/Composer/Repository/VcsRepository.php index d110c38d4..02a5f9627 100644 --- a/src/Composer/Repository/VcsRepository.php +++ b/src/Composer/Repository/VcsRepository.php @@ -21,6 +21,7 @@ use Composer\Package\Loader\ValidatingArrayLoader; use Composer\Package\Loader\InvalidPackageException; use Composer\Package\Loader\LoaderInterface; use Composer\EventDispatcher\EventDispatcher; +use Composer\Util\Platform; use Composer\Util\ProcessExecutor; use Composer\Util\HttpDownloader; use Composer\Util\Url; @@ -90,7 +91,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt 'svn' => 'Composer\Repository\Vcs\SvnDriver', ]; - $this->url = $repoConfig['url']; + $this->url = Platform::expandPath($repoConfig['url']); $this->io = $io; $this->type = $repoConfig['type'] ?? 'vcs'; $this->isVerbose = $io->isVerbose();