1
0
Fork 0

Fix handling of http://foo/packages.json style repo URLs, fixes #5135

pull/5144/head
Jordi Boggiano 2016-04-02 14:49:26 +01:00
parent 134ce134a2
commit b2b4603215
1 changed files with 3 additions and 3 deletions

View File

@ -29,7 +29,9 @@ class RepositoryFactory
*/ */
public static function configFromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false) public static function configFromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
{ {
if ("json" === pathinfo($repository, PATHINFO_EXTENSION)) { if (0 === strpos($repository, 'http')) {
$repoConfig = array('type' => 'composer', 'url' => $repository);
} elseif ("json" === pathinfo($repository, PATHINFO_EXTENSION)) {
$json = new JsonFile($repository, Factory::createRemoteFilesystem($io, $config)); $json = new JsonFile($repository, Factory::createRemoteFilesystem($io, $config));
$data = $json->read(); $data = $json->read();
if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) { if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
@ -39,8 +41,6 @@ class RepositoryFactory
} else { } else {
throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository."); throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository.");
} }
} elseif (0 === strpos($repository, 'http')) {
$repoConfig = array('type' => 'composer', 'url' => $repository);
} elseif ('{' === substr($repository, 0, 1)) { } elseif ('{' === substr($repository, 0, 1)) {
// assume it is a json object that makes a repo config // assume it is a json object that makes a repo config
$repoConfig = JsonFile::parseJson($repository); $repoConfig = JsonFile::parseJson($repository);