Browse Source

Make sure package URLs are matched case insensitively when updating

Jordi Boggiano 9 years ago
parent
commit
63bc1f5d78

+ 2 - 2
src/Packagist/WebBundle/Controller/ApiController.php

@@ -328,8 +328,8 @@ class ApiController extends Controller
         $packages = array();
         foreach ($user->getPackages() as $package) {
             if (preg_match($urlRegex, $package->getRepository(), $candidate)
-                && $candidate['host'] === $matched['host']
-                && $candidate['path'] === $matched['path']
+                && strtolower($candidate['host']) === strtolower($matched['host'])
+                && strtolower($candidate['path']) === strtolower($matched['path'])
             ) {
                 $packages[] = $package;
             }

+ 1 - 0
src/Packagist/WebBundle/Tests/Controller/ApiControllerTest.php

@@ -98,6 +98,7 @@ class ApiControllerTest extends WebTestCase
             array('github', 'https://github.com/user/repo', true),
             array('github', 'https://github.com/user/repo.git', true),
             array('github', 'git://github.com/user/repo', true),
+            array('github', 'git://github.com/User/Repo.git', true),
             array('github', 'git@github.com:user/repo.git', true),
             array('github', 'git@github.com:user/repo', true),
             array('github', 'https://github.com/user/repo/', true),