浏览代码

Also trim trailing slashes in PathRepo, refs #5164

Jordi Boggiano 9 年之前
父节点
当前提交
ad5951218b
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1 1
      src/Composer/Repository/PathRepository.php
  2. 1 1
      tests/Composer/Test/Repository/PathRepositoryTest.php

+ 1 - 1
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));
     }
 }

+ 1 - 1
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());
     }
 }