From ad5951218b45ee7e819246729e0b9173c2d2dd1b Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 11 Apr 2016 13:11:46 +0100 Subject: [PATCH] Also trim trailing slashes in PathRepo, refs #5164 --- src/Composer/Repository/PathRepository.php | 2 +- tests/Composer/Test/Repository/PathRepositoryTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Composer/Repository/PathRepository.php b/src/Composer/Repository/PathRepository.php index 9c850a672..cb93710e7 100644 --- a/src/Composer/Repository/PathRepository.php +++ b/src/Composer/Repository/PathRepository.php @@ -164,7 +164,7 @@ class PathRepository extends ArrayRepository implements ConfigurableRepositoryIn { // Ensure environment-specific path separators are normalized to URL separators return array_map(function ($val) { - return str_replace(DIRECTORY_SEPARATOR, '/', $val); + return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/'); }, glob($this->url, GLOB_MARK | GLOB_ONLYDIR)); } } diff --git a/tests/Composer/Test/Repository/PathRepositoryTest.php b/tests/Composer/Test/Repository/PathRepositoryTest.php index ebed4abe6..872deb71f 100644 --- a/tests/Composer/Test/Repository/PathRepositoryTest.php +++ b/tests/Composer/Test/Repository/PathRepositoryTest.php @@ -108,6 +108,6 @@ class PathRepositoryTest extends TestCase // Convert platform specific separators back to generic URL slashes $relativeUrl = str_replace(DIRECTORY_SEPARATOR, '/', $relativeUrl); - $this->assertEquals(rtrim($relativeUrl, '/'), rtrim($package->getDistUrl(), '/')); + $this->assertEquals($relativeUrl, $package->getDistUrl()); } }