diff --git a/src/Repository/AbstractAssetRepository.php b/src/Repository/AbstractAssetRepository.php index 893cfce..2573ce1 100644 --- a/src/Repository/AbstractAssetRepository.php +++ b/src/Repository/AbstractAssetRepository.php @@ -64,15 +64,6 @@ abstract class AbstractAssetRepository implements ConfigurableRepositoryInterfac */ public function __construct(array $repoConfig, PartialComposer $composer, IOInterface $io, Config $config, HttpDownloader $httpDownloader, ?EventDispatcher $eventDispatcher) { - $this->repoConfig = $repoConfig; - $this->composer = $composer; - $this->io = $io; - $this->config = $config; - $this->httpDownloader = $httpDownloader; - $this->eventDispatcher = $eventDispatcher; - $this->loader = new ArrayLoader(); - $this->cache = new Cache($io, $config->get('cache-repo-dir') . '/' . Preg::replace('{[^a-z0-9.]}i', '-', Url::sanitize($this->getUrl())), 'a-z0-9.$~'); - $this->cache->setReadOnly($config->get('cache-read-only')); if (isset($repoConfig['options'])) { $this->options = $repoConfig['options']; } @@ -85,6 +76,15 @@ public function __construct(array $repoConfig, PartialComposer $composer, IOInte if (isset($repoConfig['search-url'])) { $this->searchUrl = $repoConfig['search-url']; } + $this->repoConfig = $repoConfig; + $this->composer = $composer; + $this->io = $io; + $this->config = $config; + $this->httpDownloader = $httpDownloader; + $this->eventDispatcher = $eventDispatcher; + $this->loader = new ArrayLoader(); + $this->cache = new Cache($io, $config->get('cache-repo-dir') . '/' . Preg::replace('{[^a-z0-9.]}i', '-', Url::sanitize($this->getUrl())), 'a-z0-9.$~'); + $this->cache->setReadOnly($config->get('cache-read-only')); } /** diff --git a/src/Repository/BowerArtifactoryRepository.php b/src/Repository/BowerArtifactoryRepository.php index 2861797..728f5a8 100644 --- a/src/Repository/BowerArtifactoryRepository.php +++ b/src/Repository/BowerArtifactoryRepository.php @@ -74,10 +74,15 @@ protected function convertPackage(array $item): array foreach ($refs as $ref) { if (Preg::match('#^([a-f\d]{44})\s+refs/tags/(\S+)#', $ref, $matches)) { + try { + $v = $versionParser->normalize($matches[2]); + } catch (\UnexpectedValueException) { + continue; + } $results[] = [ 'name' => 'bower-asset/' . $item['name'], 'version' => $matches[2], - 'version_normalized' => $versionParser->normalize($matches[2]), + 'version_normalized' => $v, 'dist' => [ 'type' => 'tar', 'url' => $this->getUrl() . '/binaries/' . $cleanedUrl . '.git/' . $matches[2]