summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-04-18 17:03:02 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-04-18 17:12:06 +0800
commitb07da07c82e17f0be5bb5398b9b0cfec52cf2d2b (patch)
tree972eea6314234e051b4b37202fbd19866177033e /lib/gitlab/ci
parentec9f6180bc4684521444ee0681308bf4c9c71297 (diff)
downloadgitlab-ce-b07da07c82e17f0be5bb5398b9b0cfec52cf2d2b.tar.gz
Just enforce the output encoding for Ansi2html
Fixes https://sentry.gitlap.com/gitlab/gitlabcom/issues/27545/
Diffstat (limited to 'lib/gitlab/ci')
-rw-r--r--lib/gitlab/ci/trace/stream.rb13
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/gitlab/ci/trace/stream.rb b/lib/gitlab/ci/trace/stream.rb
index b929bdd55bc..e93019c4098 100644
--- a/lib/gitlab/ci/trace/stream.rb
+++ b/lib/gitlab/ci/trace/stream.rb
@@ -14,14 +14,7 @@ module Gitlab
def initialize
@stream = yield
- if @stream
- @stream.binmode
- # Ci::Ansi2html::Converter would read from @stream directly,
- # using @stream.each_line to be specific. It's safe to set
- # the encoding here because IO#seek(bytes) and IO#read(bytes)
- # are not characters based, so encoding doesn't matter to them.
- @stream.set_encoding(Encoding.default_external)
- end
+ @stream.binmode if @stream
end
def valid?
@@ -68,8 +61,8 @@ module Gitlab
def html(last_lines: nil)
text = raw(last_lines: last_lines)
- stream = StringIO.new(text)
- ::Ci::Ansi2html.convert(stream).html
+ buffer = StringIO.new(text)
+ ::Ci::Ansi2html.convert(buffer).html
end
def extract_coverage(regex)