diff --git a/src/GitList/Controller/TreeController.php b/src/GitList/Controller/TreeController.php index f807145..f14ebf2 100644 --- a/src/GitList/Controller/TreeController.php +++ b/src/GitList/Controller/TreeController.php @@ -68,13 +68,13 @@ class TreeController implements ControllerProviderInterface 'tags' => $repository->getTags(), )); })->assert('repo', $app['util.routing']->getRepositoryRegex()) - ->assert('branch', '[\w-._\/]+') + ->assert('branch', $app['util.routing']->getBranchRegex()) ->bind('search'); $route->get('{repo}/{branch}/', function ($repo, $branch) use ($app, $treeController) { return $treeController($repo, $branch); })->assert('repo', $app['util.routing']->getRepositoryRegex()) - ->assert('branch', '[\w-._\/]+') + ->assert('branch', $app['util.routing']->getBranchRegex()) ->bind('branch'); $route->get('{repo}/', function ($repo) use ($app, $treeController) { @@ -111,7 +111,7 @@ class TreeController implements ControllerProviderInterface )); })->assert('format', '(zip|tar)') ->assert('repo', $app['util.routing']->getRepositoryRegex()) - ->assert('branch', '[\w-._\/]+') + ->assert('branch', $app['util.routing']->getBranchRegex()) ->bind('archive'); return $route; diff --git a/src/GitList/Util/Routing.php b/src/GitList/Util/Routing.php index caeda25..a1e33f5 100644 --- a/src/GitList/Util/Routing.php +++ b/src/GitList/Util/Routing.php @@ -85,7 +85,7 @@ class Routing static $branchRegex = null; if ($branchRegex === null) { - $branchRegex = '[\w-._\/]+'; + $branchRegex = '(?!/|.*([/.]\.|//|@\{|\\\\))[^\040\177 ~^:?*\[]+(?