Browse Source

Appending 'packages.json' only if not present in URL

Christoph Hochstrasser 12 years ago
parent
commit
841efc98a6
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/Composer/Repository/ComposerRepository.php

+ 7 - 1
src/Composer/Repository/ComposerRepository.php

@@ -191,7 +191,13 @@ class ComposerRepository extends ArrayRepository implements NotifiableRepository
         }
 
         try {
-            $json = new JsonFile($this->url.'/packages.json', new RemoteFilesystem($this->io));
+            if ($parts = parse_url($this->url) and isset($parts['path']) and strpos($parts['path'], '/packages.json') !== false) {
+                $jsonUrl = $this->url;
+            } else {
+                $jsonUrl = $this->url . '/packages.json';
+            }
+
+            $json = new JsonFile($jsonUrl, new RemoteFilesystem($this->io));
             $data = $json->read();
 
             if (!empty($data['notify'])) {