From 6b7e80cb198926a07e3fc94ca850edd4ed4169b8 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 9 Sep 2014 17:56:33 +0300 Subject: Prevent 500 error when search wiki for non-existing repo Signed-off-by: Dmitriy Zaporozhets --- lib/gitlab/project_search_results.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/gitlab/project_search_results.rb b/lib/gitlab/project_search_results.rb index 409177cb8bd..9dc8b34d9c7 100644 --- a/lib/gitlab/project_search_results.rb +++ b/lib/gitlab/project_search_results.rb @@ -49,11 +49,16 @@ module Gitlab end def wiki_blobs - if !project.wiki_enabled? - [] + if project.wiki_enabled? + wiki_repo = Repository.new(ProjectWiki.new(project).path_with_namespace) + + if wiki_repo.exists? + wiki_repo.search_files(query) + else + [] + end else - Repository.new(ProjectWiki.new(project).path_with_namespace). - search_files(query) + [] end end -- cgit v1.2.1