diff --git a/src/GitList/Controller/BlobController.php b/src/GitList/Controller/BlobController.php index 82fc2a4..9a44a27 100644 --- a/src/GitList/Controller/BlobController.php +++ b/src/GitList/Controller/BlobController.php @@ -39,7 +39,7 @@ class BlobController implements ControllerProviderInterface 'tags' => $repository->getTags(), )); })->assert('file', '.+') - ->assert('repo', '[\w-._]+') + ->assert('repo', $app['util.routing']->getRepositoryRegex()) ->assert('branch', '[\w-._\/]+') ->bind('blob'); @@ -59,7 +59,7 @@ class BlobController implements ControllerProviderInterface return new Response($blob, 200, $headers); })->assert('file', '.+') - ->assert('repo', '[\w-._]+') + ->assert('repo', $app['util.routing']->getRepositoryRegex()) ->assert('branch', '[\w-._\/]+') ->bind('blob_raw'); diff --git a/src/GitList/Controller/CommitController.php b/src/GitList/Controller/CommitController.php index f47b0a5..776f669 100644 --- a/src/GitList/Controller/CommitController.php +++ b/src/GitList/Controller/CommitController.php @@ -38,7 +38,7 @@ class CommitController implements ControllerProviderInterface 'commits' => $categorized, 'file' => $file, )); - })->assert('repo', '[\w-._]+') + })->assert('repo', $app['util.routing']->getRepositoryRegex()) ->assert('branch', '[\w-._\/]+') ->assert('file', '.+') ->value('branch', 'master') @@ -63,7 +63,7 @@ class CommitController implements ControllerProviderInterface 'branches' => $repository->getBranches(), 'tags' => $repository->getTags(), )); - })->assert('repo', '[\w-._]+') + })->assert('repo', $app['util.routing']->getRepositoryRegex()) ->bind('searchcommits'); $route->get('{repo}/commit/{commit}/', function($repo, $commit) use ($app) { @@ -75,7 +75,7 @@ class CommitController implements ControllerProviderInterface 'repo' => $repo, 'commit' => $commit, )); - })->assert('repo', '[\w-._]+') + })->assert('repo', $app['util.routing']->getRepositoryRegex()) ->assert('commit', '[a-f0-9^]+') ->bind('commit'); @@ -94,7 +94,7 @@ class CommitController implements ControllerProviderInterface 'tags' => $repository->getTags(), 'blames' => $blames, )); - })->assert('repo', '[\w-._]+') + })->assert('repo', $app['util.routing']->getRepositoryRegex()) ->assert('file', '.+') ->assert('branch', '[\w-._\/]+') ->bind('blame'); diff --git a/src/GitList/Controller/MainController.php b/src/GitList/Controller/MainController.php index dcf17cc..ed187c7 100644 --- a/src/GitList/Controller/MainController.php +++ b/src/GitList/Controller/MainController.php @@ -33,7 +33,7 @@ class MainController implements ControllerProviderInterface 'stats' => $stats, 'authors' => $authors, )); - })->assert('repo', '[\w-._]+') + })->assert('repo', $app['util.routing']->getRepositoryRegex()) ->assert('branch', '[\w-._\/]+') ->value('branch', 'master') ->bind('stats'); @@ -49,7 +49,7 @@ class MainController implements ControllerProviderInterface )); return new Response($html, 200, array('Content-Type' => 'application/rss+xml')); - })->assert('repo', '[\w-._]+') + })->assert('repo', $app['util.routing']->getRepositoryRegex()) ->assert('branch', '[\w-._\/]+') ->bind('rss'); diff --git a/src/GitList/Controller/TreeController.php b/src/GitList/Controller/TreeController.php index f7cd7eb..fe463b7 100644 --- a/src/GitList/Controller/TreeController.php +++ b/src/GitList/Controller/TreeController.php @@ -41,7 +41,7 @@ class TreeController implements ControllerProviderInterface 'tags' => $repository->getTags(), 'readme' => $app['util.repository']->getReadme($repo, $branch), )); - })->assert('repo', '[\w-._]+') + })->assert('repo', $app['util.routing']->getRepositoryRegex()) ->assert('branch', '[\w-._\/]+') ->assert('tree', '.+') ->bind('tree'); @@ -65,19 +65,19 @@ class TreeController implements ControllerProviderInterface 'branches' => $repository->getBranches(), 'tags' => $repository->getTags(), )); - })->assert('repo', '[\w-._]+') + })->assert('repo', $app['util.routing']->getRepositoryRegex()) ->assert('branch', '[\w-._\/]+') ->bind('search'); $route->get('{repo}/{branch}/', function($repo, $branch) use ($app, $treeController) { return $treeController($repo, $branch); - })->assert('repo', '[\w-._]+') + })->assert('repo', $app['util.routing']->getRepositoryRegex()) ->assert('branch', '[\w-._\/]+') ->bind('branch'); $route->get('{repo}/', function($repo) use ($app, $treeController) { return $treeController($repo); - })->assert('repo', '[\w-._]+') + })->assert('repo', $app['util.routing']->getRepositoryRegex()) ->bind('repository'); $route->get('{repo}/{format}ball/{branch}', function($repo, $format, $branch) use ($app) { @@ -108,7 +108,7 @@ class TreeController implements ControllerProviderInterface 'Content-Transfer-Encoding' => 'binary', )); })->assert('format', '(zip|tar)') - ->assert('repo', '[\w-._]+') + ->assert('repo', $app['util.routing']->getRepositoryRegex()) ->assert('branch', '[\w-._\/]+') ->bind('archive');