From e508a3479dc5b99f94363ec1ebfa857fcabfd3f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Prochowski?= Date: Tue, 19 Jun 2012 10:34:51 +0200 Subject: [PATCH] * Fix notice error if file readme don't exists. * Show readme box for file with `readme` suffix (eg readme, readme.md. readme.txt, readme.markdown etc). --- lib/Application/Utils.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/Application/Utils.php b/lib/Application/Utils.php index 76ee742..a35784f 100644 --- a/lib/Application/Utils.php +++ b/lib/Application/Utils.php @@ -252,12 +252,9 @@ class Utils $files = $repository->getTree('master')->output(); foreach ($files as $fileInfo) - if (preg_match('/^readme(\.md|\.markdown|)$/i', $fileInfo['name'])) { - $readmeFile = $fileInfo['name']; - break; + if (preg_match('/^readme*/i', $fileInfo['name'])) { + return array('filename' => $fileInfo['name'], 'content' => $repository->getBlob("$branch:'".$fileInfo['name']."'")->output()); } - - if ($readmeFile) return array('filename' => $readmeFile, 'content' => $repository->getBlob("$branch:'$readmeFile'")->output()); return array(); } } \ No newline at end of file