Fix escaping issue with dashes, hashes.

This commit is contained in:
Gary
2015-07-30 10:07:43 +01:00
parent 8a608fc80d
commit 12080cee1a

View File

@@ -106,36 +106,24 @@ class Routing
public function getRepositoryRegex()
{
static $regex = null;
if ($regex === null) {
$isWindows = $this->isWindows();
$quotedPaths = array_map(
function ($repo) use ($isWindows) {
$repoName = preg_quote($repo['name']);
if ($isWindows) {
$repoName = str_replace('\\', '\\\\', $repoName);
}
return $repoName;
function ($repo) {
return preg_quote($repo['name'], '#');
},
$this->app['git']->getRepositories($this->app['git.repos'])
);
usort(
$quotedPaths,
function ($a, $b) {
return strlen($b) - strlen($a);
}
);
$regex = implode('|', $quotedPaths);
}
return $regex;
}
public function isWindows()
{
switch (PHP_OS) {