1
0
Fork 0

Fix issues handling branch names with pipes in them

pull/8661/head
Jordi Boggiano 2020-02-28 16:00:45 +01:00
parent 05737a46fb
commit 7a270955f5
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 8 additions and 2 deletions

View File

@ -20,6 +20,7 @@ use Composer\Package\Loader\ValidatingArrayLoader;
use Composer\Package\Loader\InvalidPackageException; use Composer\Package\Loader\InvalidPackageException;
use Composer\Package\Loader\LoaderInterface; use Composer\Package\Loader\LoaderInterface;
use Composer\EventDispatcher\EventDispatcher; use Composer\EventDispatcher\EventDispatcher;
use Composer\Semver\Constraint\Constraint;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\Config; use Composer\Config;
@ -363,7 +364,12 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
private function validateBranch($branch) private function validateBranch($branch)
{ {
try { try {
return $this->versionParser->normalizeBranch($branch); $normalizedBranch = $this->versionParser->normalizeBranch($branch);
// validate that the branch name has no weird characters conflicting with constraints
$this->versionParser->parseConstraints($normalizedBranch);
return $normalizedBranch;
} catch (\Exception $e) { } catch (\Exception $e) {
} }
@ -403,7 +409,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
$this->io->overwriteError($msg, false); $this->io->overwriteError($msg, false);
} }
if ($existingPackage = $this->findPackage($cachedPackage['name'], $cachedPackage['version_normalized'])) { if ($existingPackage = $this->findPackage($cachedPackage['name'], new Constraint('=', $cachedPackage['version_normalized']))) {
if ($isVeryVerbose) { if ($isVeryVerbose) {
$this->io->writeError('<warning>Skipped cached version '.$version.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$cachedPackage['version_normalized'].' internally</warning>'); $this->io->writeError('<warning>Skipped cached version '.$version.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$cachedPackage['version_normalized'].' internally</warning>');
} }