diff --git a/controllers/blobController.php b/controllers/blobController.php index 2e107bf..822fbed 100644 --- a/controllers/blobController.php +++ b/controllers/blobController.php @@ -2,7 +2,7 @@ $app->get('{repo}/blob/{branch}/{file}/', function($repo, $branch, $file) use($app) { $repository = $app['git']->getRepository($app['git.repos'] . $repo); - $blob = $repository->getBlob("$branch:$file"); + $blob = $repository->getBlob("$branch:'$file'"); $breadcrumbs = $app['utils']->getBreadcrumbs("$repo/tree/$branch/$file"); $fileType = $app['utils']->getFileType($file); @@ -24,9 +24,9 @@ $app->get('{repo}/blob/{branch}/{file}/', function($repo, $branch, $file) use($a $app->get('{repo}/raw/{branch}/{file}', function($repo, $branch, $file) use($app) { $repository = $app['git']->getRepository($app['git.repos'] . $repo); - $blob = $repository->getBlob("$branch:$file")->output(); + $blob = $repository->getBlob("$branch:'$file'")->output(); return new Symfony\Component\HttpFoundation\Response($blob, 200, array('Content-Type' => 'text/plain')); })->assert('file', '.+') ->assert('repo', '[\w-._]+') - ->assert('branch', '[\w-._]+'); \ No newline at end of file + ->assert('branch', '[\w-._]+'); diff --git a/lib/Git/Model/Tree.php b/lib/Git/Model/Tree.php index bccb71c..3736e59 100644 --- a/lib/Git/Model/Tree.php +++ b/lib/Git/Model/Tree.php @@ -33,7 +33,7 @@ class Tree extends ScopeAware implements \RecursiveIterator continue; } - $files[] = preg_split("/[\s]+/", $line); + $files[] = preg_split("/[\s]+/", $line, 5); } foreach ($files as $file) { @@ -169,4 +169,4 @@ class Tree extends ScopeAware implements \RecursiveIterator { $this->name = $name; } -} \ No newline at end of file +}