From 470a79ce6833dab41aef408bcc184dab2f73aa1a Mon Sep 17 00:00:00 2001 From: borislav Date: Sun, 23 Sep 2012 16:16:57 +0200 Subject: [PATCH] Add file name escaping for 'history' and 'blame' commands Escape file names in order to allow them to contain spaces or other funky characters (such as braces) which are special for the shell. --- src/GitList/Controller/CommitController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GitList/Controller/CommitController.php b/src/GitList/Controller/CommitController.php index ee60e12..d7659d7 100644 --- a/src/GitList/Controller/CommitController.php +++ b/src/GitList/Controller/CommitController.php @@ -16,7 +16,7 @@ class CommitController implements ControllerProviderInterface $route->get('{repo}/commits/{branch}/{file}', function($repo, $branch, $file) use ($app) { $repository = $app['git']->getRepository($app['git.repos'] . $repo); - $type = $file ? "$branch -- $file" : $branch; + $type = $file ? "$branch -- \"$file\"" : $branch; $pager = $app['util.view']->getPager($app['request']->get('page'), $repository->getTotalCommits($type)); $commits = $repository->getPaginatedCommits($type, $pager['current']); @@ -80,7 +80,7 @@ class CommitController implements ControllerProviderInterface $route->get('{repo}/blame/{branch}/{file}', function($repo, $branch, $file) use ($app) { $repository = $app['git']->getRepository($app['git.repos'] . $repo); - $blames = $repository->getBlame("$branch -- $file"); + $blames = $repository->getBlame("$branch -- \"$file\""); return $app['twig']->render('blame.twig', array( 'file' => $file,