Browse Source

Make sure github PINGs are also working fine

Jordi Boggiano 9 years ago
parent
commit
b907a5a2e3
1 changed files with 1 additions and 0 deletions
  1. 1 0
      src/Packagist/WebBundle/Controller/ApiController.php

+ 1 - 0
src/Packagist/WebBundle/Controller/ApiController.php

@@ -112,6 +112,7 @@ class ApiController extends Controller
         if (isset($payload['repository']['url'])) { // github/gitlab/anything hook
             $urlRegex = '{^(?:ssh://git@|https?://|git://|git@)?(?P<host>[a-z0-9.-]+)(?::[0-9]+/|[:/])(?P<path>[\w.-]+/[\w.-]+?)(?:\.git|/)?$}i';
             $url = $payload['repository']['url'];
+            $url = str_replace('https://api.github.com/repos', 'https://github.com', $url);
         } elseif (isset($payload['repository']['links']['html']['href'])) { // bitbucket push event payload
             $urlRegex = '{^(?:https?://|git://|git@)?(?:api\.)?(?P<host>bitbucket\.org)[/:](?P<path>[\w.-]+/[\w.-]+?)(\.git)?/?$}i';
             $url = $payload['repository']['links']['html']['href'];