1
0
Fork 0

Allow underscores in cache keys to avoid conflicts with package names containing underscore vs dashes, fixes #11224 (#11229)

pull/11233/head
Jordi Boggiano 2022-12-18 00:03:48 +01:00 committed by GitHub
parent 5e6ccae116
commit be053cb18e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -47,7 +47,7 @@ class Cache
* @param Filesystem $filesystem optional filesystem instance * @param Filesystem $filesystem optional filesystem instance
* @param bool $readOnly whether the cache is in readOnly mode * @param bool $readOnly whether the cache is in readOnly mode
*/ */
public function __construct(IOInterface $io, string $cacheDir, string $allowlist = 'a-z0-9.', ?Filesystem $filesystem = null, bool $readOnly = false) public function __construct(IOInterface $io, string $cacheDir, string $allowlist = 'a-z0-9._', ?Filesystem $filesystem = null, bool $readOnly = false)
{ {
$this->io = $io; $this->io = $io;
$this->root = rtrim($cacheDir, '/\\') . '/'; $this->root = rtrim($cacheDir, '/\\') . '/';

View File

@ -175,7 +175,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
assert($baseUrl !== ''); assert($baseUrl !== '');
$this->baseUrl = $baseUrl; $this->baseUrl = $baseUrl;
$this->io = $io; $this->io = $io;
$this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', Url::sanitize($this->url)), 'a-z0-9.$~'); $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', Url::sanitize($this->url)), 'a-z0-9.$~_');
$this->cache->setReadOnly($config->get('cache-read-only')); $this->cache->setReadOnly($config->get('cache-read-only'));
$this->versionParser = new VersionParser(); $this->versionParser = new VersionParser();
$this->loader = new ArrayLoader($this->versionParser); $this->loader = new ArrayLoader($this->versionParser);