浏览代码

Allow configuring a path repo to an empty path as long as using wildcards and the wildcard root exists, fixes #8679

Jordi Boggiano 5 年之前
父节点
当前提交
d559bf5387
共有 1 个文件被更改,包括 11 次插入0 次删除
  1. 11 0
      src/Composer/Repository/PathRepository.php

+ 11 - 0
src/Composer/Repository/PathRepository.php

@@ -128,6 +128,17 @@ class PathRepository extends ArrayRepository implements ConfigurableRepositoryIn
         $urlMatches = $this->getUrlMatches();
         $urlMatches = $this->getUrlMatches();
 
 
         if (empty($urlMatches)) {
         if (empty($urlMatches)) {
+            if (preg_match('{[*{}]}', $this->url)) {
+                $url = $this->url;
+                while (preg_match('{[*{}]}', $url)) {
+                    $url = dirname($url);
+                }
+                // the parent directory before any wildcard exists, so we assume it is correctly configured but simply empty
+                if (is_dir($url)) {
+                    return;
+                }
+            }
+
             throw new \RuntimeException('The `url` supplied for the path (' . $this->url . ') repository does not exist');
             throw new \RuntimeException('The `url` supplied for the path (' . $this->url . ') repository does not exist');
         }
         }