Browse Source

Make sure we avoid adding github repos with subpar URLs

Jordi Boggiano 8 years ago
parent
commit
63ae4de16e
1 changed files with 3 additions and 0 deletions
  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