Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2018-02-28 13:22:04 +0300
committerSean McGivern <sean@gitlab.com>2018-02-28 13:22:04 +0300
commitb3c096cddc395080f563a35f933620294f7cbcb0 (patch)
treeb4081d236fdfeab89c93e3c71e4c0b5187292e42 /lib/gitlab/search_results.rb
parent4371f845649deaf6bf31f0a675b33f1d58f64de4 (diff)
Fix code search results with non-ASCII data
Gitlab::Git::Popen#popen now returns ASCII-8BIT (binary) data always, so we need to handle that explicitly.
Diffstat (limited to 'lib/gitlab/search_results.rb')
-rw-r--r--lib/gitlab/search_results.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/gitlab/search_results.rb b/lib/gitlab/search_results.rb
index 5a5ae7f19d4..781783f4d97 100644
--- a/lib/gitlab/search_results.rb
+++ b/lib/gitlab/search_results.rb
@@ -1,6 +1,8 @@
module Gitlab
class SearchResults
class FoundBlob
+ include EncodingHelper
+
attr_reader :id, :filename, :basename, :ref, :startline, :data, :project_id
def initialize(opts = {})
@@ -9,7 +11,7 @@ module Gitlab
@basename = opts.fetch(:basename, nil)
@ref = opts.fetch(:ref, nil)
@startline = opts.fetch(:startline, nil)
- @data = opts.fetch(:data, nil)
+ @data = encode_utf8(opts.fetch(:data, nil))
@per_page = opts.fetch(:per_page, 20)
@project_id = opts.fetch(:project_id, nil)
end