diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-09 17:56:33 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-09 17:56:33 +0300 |
commit | 6b7e80cb198926a07e3fc94ca850edd4ed4169b8 (patch) | |
tree | 19da5272ee85e8a544df363f64d19e355a7690c3 /lib | |
parent | 638331d05a23eed00a3596a0d2ec02aa0f917337 (diff) | |
download | gitlab-ce-6b7e80cb198926a07e3fc94ca850edd4ed4169b8.tar.gz |
Prevent 500 error when search wiki for non-existing repo
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/project_search_results.rb | 13 |
1 files changed, 9 insertions, 4 deletions
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 |