summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-09-09 17:56:33 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-09-09 17:56:33 +0300
commit6b7e80cb198926a07e3fc94ca850edd4ed4169b8 (patch)
tree19da5272ee85e8a544df363f64d19e355a7690c3
parent638331d05a23eed00a3596a0d2ec02aa0f917337 (diff)
downloadgitlab-ce-6b7e80cb198926a07e3fc94ca850edd4ed4169b8.tar.gz
Prevent 500 error when search wiki for non-existing repo
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r--CHANGELOG1
-rw-r--r--lib/gitlab/project_search_results.rb13
2 files changed, 10 insertions, 4 deletions
diff --git a/CHANGELOG b/CHANGELOG
index fbbce0fcda0..efecd5ae671 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -24,6 +24,7 @@ v 7.3.0
- Comment & Close button
- Process git push --all much faster
- Don't allow edit of system notes
+ - Project wiki search (Ralf Seidler)
v 7.2.1
- Delete orphaned labels during label migration (James Brooks)
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