소스 검색

Fix handling of www.github.com in GitHubDriver, fixes composer/packagist#572

Jordi Boggiano 9 년 전
부모
커밋
afd98b74f1
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      src/Composer/Repository/Vcs/GitHubDriver.php

+ 4 - 1
src/Composer/Repository/Vcs/GitHubDriver.php

@@ -50,6 +50,9 @@ class GitHubDriver extends VcsDriver
         $this->owner = $match[3];
         $this->repository = $match[4];
         $this->originUrl = !empty($match[1]) ? $match[1] : $match[2];
+        if ($this->originUrl === 'www.github.com') {
+            $this->originUrl = 'github.com';
+        }
         $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
 
         if (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api']) {
@@ -260,7 +263,7 @@ class GitHubDriver extends VcsDriver
         }
 
         $originUrl = !empty($matches[2]) ? $matches[2] : $matches[3];
-        if (!in_array($originUrl, $config->get('github-domains'))) {
+        if (!in_array(preg_replace('{^www\.}i', '', $originUrl), $config->get('github-domains'))) {
             return false;
         }