瀏覽代碼

ApiController: allow (optional) port number in package url, properly

Boris Momčilović 9 年之前
父節點
當前提交
ebb0c3cc0d
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/Packagist/WebBundle/Controller/ApiController.php

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

@@ -111,7 +111,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';
+            $urlRegex = '{^(?:ssh://git@|https?://|git://|git@)?(?P<host>[a-z0-9.-]+)(?::[0-9]+/|[:/])(?P<path>[\w.-]+/[\w.-]+?)(?:\.git)?$}i';
             $url = $payload['repository']['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';