From b2b46032154d21670e9ae3e84bb92efdf3522d02 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 2 Apr 2016 14:49:26 +0100 Subject: [PATCH] Fix handling of http://foo/packages.json style repo URLs, fixes #5135 --- src/Composer/Repository/RepositoryFactory.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Composer/Repository/RepositoryFactory.php b/src/Composer/Repository/RepositoryFactory.php index 5b585d00d..681e3bfee 100644 --- a/src/Composer/Repository/RepositoryFactory.php +++ b/src/Composer/Repository/RepositoryFactory.php @@ -29,7 +29,9 @@ class RepositoryFactory */ 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)); $data = $json->read(); if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) { @@ -39,8 +41,6 @@ class RepositoryFactory } else { 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)) { // assume it is a json object that makes a repo config $repoConfig = JsonFile::parseJson($repository);