Explorar o código

Make sure we avoid adding github repos with subpar URLs

Jordi Boggiano %!s(int64=8) %!d(string=hai) anos
pai
achega
63ae4de16e
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      src/Packagist/WebBundle/Entity/Package.php

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

@@ -552,6 +552,9 @@ class Package
         }
 
         $repoUrl = preg_replace('{^git@github.com:}i', 'https://github.com/', $repoUrl);
+        $repoUrl = preg_replace('{^git://github.com/}i', 'https://github.com/', $repoUrl);
+        $repoUrl = preg_replace('{^(https://github.com/.*?)\.git$}i', '$1', $repoUrl);
+
         $this->repository = $repoUrl;
 
         // avoid user@host URLs