From 9dfb809c578735d807070d77ad567ab5c3de9b6c Mon Sep 17 00:00:00 2001
From: Tomasz Maczukin <tomasz@maczukin.pl>
Date: Wed, 8 Jun 2016 19:39:33 +0200
Subject: [PATCH 1/2] Fix UTF-8 handling in incremental trace update API

---
 app/models/ci/build.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index b8ada6361ace..6a64ca451f77 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -194,7 +194,7 @@ def trace
 
     def trace_length
       if raw_trace
-        raw_trace.length
+        raw_trace.bytesize
       else
         0
       end
@@ -216,7 +216,7 @@ def append_trace(trace_part, offset)
       recreate_trace_dir
 
       File.truncate(path_to_trace, offset) if File.exist?(path_to_trace)
-      File.open(path_to_trace, 'a') do |f|
+      File.open(path_to_trace, 'ab') do |f|
         f.write(trace_part)
       end
     end
-- 
GitLab


From 34bef254644b4ecda4ac61a82447a23f081aeca0 Mon Sep 17 00:00:00 2001
From: Tomasz Maczukin <tomasz@maczukin.pl>
Date: Wed, 8 Jun 2016 20:03:19 +0200
Subject: [PATCH 2/2] Update CHANGELOG

---
 CHANGELOG | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG b/CHANGELOG
index b00c149a753c..c0918cfb9f9e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -70,6 +70,7 @@ v 8.8.5 (unreleased)
   - Import GitHub repositories respecting the API rate limit
   - Fix importer for GitHub comments on diff
   - Disable Webhooks before proceeding with the GitHub import
+  - Fix incremental trace upload API when using multi-byte UTF-8 chars in trace
 
 v 8.8.4
   - Fix LDAP-based login for users with 2FA enabled. !4493
-- 
GitLab