From 7bf67f880bef06d2ff9a2728cd1d83e0077f67c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ebbrecht?= Date: Wed, 29 Apr 2015 23:23:12 +0200 Subject: [PATCH] fixed issue #573 (only numbers in repo names), added repo name to zip/tar ball for better identification --- src/GitList/Controller/TreeController.php | 5 ++--- src/GitList/Git/Client.php | 5 ++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/GitList/Controller/TreeController.php b/src/GitList/Controller/TreeController.php index b920194..d3d9fe6 100644 --- a/src/GitList/Controller/TreeController.php +++ b/src/GitList/Controller/TreeController.php @@ -97,9 +97,8 @@ class TreeController implements ControllerProviderInterface * Generating name for downloading, lowercasing and removing all non * ascii and special characters */ - $filename = strtolower($branch); - $filename = preg_replace('#[^a-z0-9]#', '_', $filename); - $filename = preg_replace('#_+#', '_', $filename); + $filename = strtolower($repo.'_'.$branch); + $filename = preg_replace('#[^a-z0-9]+#', '_', $filename); $filename = $filename . '.' . $format; $response = new BinaryFileResponse($file); diff --git a/src/GitList/Git/Client.php b/src/GitList/Git/Client.php index 8a1e055..14575e8 100644 --- a/src/GitList/Git/Client.php +++ b/src/GitList/Git/Client.php @@ -42,7 +42,10 @@ class Client extends BaseClient throw new \RuntimeException('There are no GIT repositories in ' . $path); } - $allRepositories = array_merge($allRepositories, $repositories); + /** + * Use "+" to preserve keys, only a problem with numeric repos + */ + $allRepositories = $allRepositories + $repositories; } $allRepositories = array_unique($allRepositories, SORT_REGULAR);