diff options
author | haseeb <haseebeqx@gmail.com> | 2017-11-30 09:57:58 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-11-30 09:57:58 +0000 |
commit | 869877ab2691f94927e49610349e284633688819 (patch) | |
tree | 3221ac2b8013380d702788a733f36a269a68136a /lib/gitlab/project_search_results.rb | |
parent | 73e48b745c34c048c56abf28e6c278707d9bd2f3 (diff) | |
download | gitlab-ce-869877ab2691f94927e49610349e284633688819.tar.gz |
fix for special charecter in file names
Diffstat (limited to 'lib/gitlab/project_search_results.rb')
-rw-r--r-- | lib/gitlab/project_search_results.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/gitlab/project_search_results.rb b/lib/gitlab/project_search_results.rb index 561aa9e162c..e2662fc362b 100644 --- a/lib/gitlab/project_search_results.rb +++ b/lib/gitlab/project_search_results.rb @@ -47,8 +47,11 @@ module Gitlab startline = 0 result.each_line.each_with_index do |line, index| - if line =~ /^.*:.*:\d+:/ - ref, filename, startline = line.split(':') + matches = line.match(/^(?<ref>[^:]*):(?<filename>.*):(?<startline>\d+):/) + if matches + ref = matches[:ref] + filename = matches[:filename] + startline = matches[:startline] startline = startline.to_i - index extname = Regexp.escape(File.extname(filename)) basename = filename.sub(/#{extname}$/, '') |