mirror of
https://github.com/klaussilveira/gitlist.git
synced 2025-11-18 03:30:55 +01:00
Correct handling of filenames with spaces. Fixes #25
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
$app->get('{repo}/blob/{branch}/{file}/', function($repo, $branch, $file) use($app) {
|
$app->get('{repo}/blob/{branch}/{file}/', function($repo, $branch, $file) use($app) {
|
||||||
$repository = $app['git']->getRepository($app['git.repos'] . $repo);
|
$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");
|
$breadcrumbs = $app['utils']->getBreadcrumbs("$repo/tree/$branch/$file");
|
||||||
$fileType = $app['utils']->getFileType($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) {
|
$app->get('{repo}/raw/{branch}/{file}', function($repo, $branch, $file) use($app) {
|
||||||
$repository = $app['git']->getRepository($app['git.repos'] . $repo);
|
$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'));
|
return new Symfony\Component\HttpFoundation\Response($blob, 200, array('Content-Type' => 'text/plain'));
|
||||||
})->assert('file', '.+')
|
})->assert('file', '.+')
|
||||||
->assert('repo', '[\w-._]+')
|
->assert('repo', '[\w-._]+')
|
||||||
->assert('branch', '[\w-._]+');
|
->assert('branch', '[\w-._]+');
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class Tree extends ScopeAware implements \RecursiveIterator
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$files[] = preg_split("/[\s]+/", $line);
|
$files[] = preg_split("/[\s]+/", $line, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
@@ -169,4 +169,4 @@ class Tree extends ScopeAware implements \RecursiveIterator
|
|||||||
{
|
{
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user