Create intermediary variable for query value with leading slashes removed.

This commit is contained in:
Andrew McCallum 2018-01-15 14:43:12 +00:00
parent bce6a89152
commit 7ce732fb37
1 changed files with 3 additions and 1 deletions

View File

@ -940,7 +940,9 @@ class Repository
def search_files_by_name(query, ref)
return [] if empty? || query.blank?
args = %W(ls-tree --full-tree -r #{ref || root_ref} --name-status | #{Regexp.escape(query.sub(/^\/*/, ""))})
safe_query = query.sub(/^\/*/, "")
args = %W(ls-tree --full-tree -r #{ref || root_ref} --name-status | #{Regexp.escape(safe_query)})
run_git(args).first.lines.map(&:strip)
end