From d40a7e7d297470e125d65a0d31836f626c8a1cae Mon Sep 17 00:00:00 2001 From: Klaus Silveira Date: Sat, 17 May 2014 23:35:48 -0300 Subject: [PATCH] Escaping repo names for dynamic regex. Fixes #426 --- src/GitList/Util/Routing.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/GitList/Util/Routing.php b/src/GitList/Util/Routing.php index a8dcc17..677f2aa 100644 --- a/src/GitList/Util/Routing.php +++ b/src/GitList/Util/Routing.php @@ -108,15 +108,15 @@ class Routing static $regex = null; if ($regex === null) { - $app = $this->app; - $self = $this; + $isWindows = $this->isWindows(); $quotedPaths = array_map( - function ($repo) use ($app, $self) { - $repoName = $repo['name']; - //Windows - if ($self->isWindows()){ - $repoName = str_replace('\\', '\\\\',$repoName); + function ($repo) use ($isWindows) { + $repoName = preg_quote($repo['name']); + + if ($isWindows) { + $repoName = str_replace('\\', '\\\\', $repoName); } + return $repoName; }, $this->app['git']->getRepositories($this->app['git.repos'])