Browse Source

Normalize protocol case

Jordi Boggiano 8 năm trước cách đây
mục cha
commit
1caa0916a2
1 tập tin đã thay đổi với 3 bổ sung0 xóa
  1. 3 0
      src/Packagist/WebBundle/Entity/Package.php

+ 3 - 0
src/Packagist/WebBundle/Entity/Package.php

@@ -567,6 +567,9 @@ class Package
         $repoUrl = preg_replace('{^git://github.com/}i', 'https://github.com/', $repoUrl);
         $repoUrl = preg_replace('{^(https://github.com/.*?)\.git$}i', '$1', $repoUrl);
 
+        // normalize protocol case
+        $repoUrl = preg_replace_callback('{^(https?|git|svn)://}i', function ($match) { return strtolower($match[1]) . '://'; }, $repoUrl);
+
         $this->repository = $repoUrl;
 
         // avoid user@host URLs