summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorAndrew McCallum <andrew.mccallum@semafone.com>2018-01-15 15:19:43 +0000
committerAndrew McCallum <andrew.mccallum@semafone.com>2018-01-15 15:19:43 +0000
commita539e03d7e4f12cfaa3ae7998dd111f498f4c8dc (patch)
tree09749110027c9e57012d0dd52e137a2a96b6cb14 /app/models
parent7ce732fb3746df82790ea80a48560e62b486b225 (diff)
downloadgitlab-ce-a539e03d7e4f12cfaa3ae7998dd111f498f4c8dc.tar.gz
Account for query of only forward slash(es).
Diffstat (limited to 'app/models')
-rw-r--r--app/models/repository.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index f3ec65a1885..c258cffb274 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -938,10 +938,10 @@ class Repository
end
def search_files_by_name(query, ref)
- return [] if empty? || query.blank?
-
safe_query = query.sub(/^\/*/, "")
+ return [] if empty? || safe_query.blank?
+
args = %W(ls-tree --full-tree -r #{ref || root_ref} --name-status | #{Regexp.escape(safe_query)})
run_git(args).first.lines.map(&:strip)