Browse Source

Make artifact paths in lock file cross-platform, fixes #3832

Jordi Boggiano 9 years ago
parent
commit
8a2d1a2ee2

+ 1 - 1
src/Composer/Repository/ArtifactRepository.php

@@ -143,7 +143,7 @@ class ArtifactRepository extends ArrayRepository implements ConfigurableReposito
         $package = JsonFile::parseJson($json, $composerFile);
         $package['dist'] = array(
             'type' => 'zip',
-            'url' => $file->getPathname(),
+            'url' => strtr($file->getPathname(), '\\', '/'),
             'shasum' => sha1_file($file->getRealPath()),
         );
 

+ 1 - 1
tests/Composer/Test/Repository/ArtifactRepositoryTest.php

@@ -60,7 +60,7 @@ class ArtifactRepositoryTest extends TestCase
         $repo = new ArtifactRepository($coordinates, new NullIO(), new Config());
 
         foreach ($repo->getPackages() as $package) {
-            $this->assertTrue(strpos($package->getDistUrl(), $absolutePath) === 0);
+            $this->assertTrue(strpos($package->getDistUrl(), strtr($absolutePath, '\\', '/')) === 0);
         }
     }