summaryrefslogtreecommitdiff
path: root/app/services/search
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2014-07-28 00:27:15 +0200
committerRobert Schilling <rschilling@student.tugraz.at>2014-08-11 11:31:37 +0200
commitda7e14c864eb039ffe1c06409681721892917b71 (patch)
treeadcc5ac17ffeb26c17527164ebe56bfb33ffa05c /app/services/search
parent9d3e384ae6553fee85b7a1ed2b99a18a9884606e (diff)
downloadgitlab-ce-da7e14c864eb039ffe1c06409681721892917b71.tar.gz
fix searching on empty project, prevent 500
Fix hound
Diffstat (limited to 'app/services/search')
-rw-r--r--app/services/search/project_service.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/services/search/project_service.rb b/app/services/search/project_service.rb
index 493dee95f90..8aac18840e4 100644
--- a/app/services/search/project_service.rb
+++ b/app/services/search/project_service.rb
@@ -12,7 +12,13 @@ module Search
return result unless query.present?
if params[:search_code].present?
- blobs = project.repository.search_files(query, params[:repository_ref]) unless project.empty_repo?
+ if !@project.empty_repo?
+ blobs = project.repository.search_files(query,
+ params[:repository_ref])
+ else
+ blobs = Array.new
+ end
+
blobs = Kaminari.paginate_array(blobs).page(params[:page]).per(20)
result[:blobs] = blobs
result[:total_results] = blobs.total_count