diff --git a/CHANGELOG b/CHANGELOG
index 3a8fcb7b785863832cb7a0609248aa9061123580..a17d0992f5babdc08a8fb14c3cd0f7c8bbeaa40f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 Please view this file on the master branch, on stable branches it's out of date.
 
 v 7.14.0 (unreleased)
+  - Fix corrupted binary files when using API files endpoint (Stan Hu)
   - Show incompatible projects in Bitbucket import status (Stan Hu)
   - Fix coloring of diffs on MR Discussion-tab (Gert Goet)
   - Fix "Network" and "Graphs" pages for branches with encoded slashes (Stan Hu)
@@ -44,6 +45,9 @@ v 7.14.0 (unreleased)
   - Remove satellites
   - Remove comments and email addresses when publicly exposing ssh keys (Zeger-Jan van de Weg)
   - Cache all events
+  - Order commits by date when comparing branches
+  - Fix bug causing error when the target branch of a symbolic ref was deleted
+  - Include branch/tag name in archive file and directory name
 
 v 7.13.3
   - Fix bug causing Bitbucket importer to crash when OAuth application had been removed.
diff --git a/Gemfile b/Gemfile
index 1c49a603798fb01bf507cf24c2e3d506c956901c..c2d618f41de154aab161545341bf440d06d7ffc1 100644
--- a/Gemfile
+++ b/Gemfile
@@ -38,7 +38,7 @@ gem "browser", '~> 0.8.0'
 
 # Extracting information from a git repository
 # Provide access to Gitlab::Git library
-gem "gitlab_git", '~> 7.2.6'
+gem "gitlab_git", '~> 7.2.11'
 
 # Ruby/Rack Git Smart-HTTP Server Handler
 # GitLab fork with a lot of changes (improved thread-safety, better memory usage etc)
diff --git a/Gemfile.lock b/Gemfile.lock
index e72b7fe49278b6b4144b382bbf63975e7d4878ae..dae8f2209eca795dbf71d04dfb0a784f343b6927 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -271,7 +271,7 @@ GEM
       mime-types (~> 1.19)
     gitlab_emoji (0.1.0)
       gemojione (~> 2.0)
-    gitlab_git (7.2.6)
+    gitlab_git (7.2.11)
       activesupport (~> 4.0)
       charlock_holmes (~> 0.6)
       gitlab-linguist (~> 3.0)
@@ -783,7 +783,7 @@ DEPENDENCIES
   gitlab-grack (~> 2.0.2)
   gitlab-linguist (~> 3.0.1)
   gitlab_emoji (~> 0.1)
-  gitlab_git (~> 7.2.6)
+  gitlab_git (~> 7.2.11)
   gitlab_meta (= 7.0)
   gitlab_omniauth-ldap (= 1.2.1)
   gollum-lib (~> 4.0.2)
diff --git a/lib/api/files.rb b/lib/api/files.rb
index c7b30cf2f0768f028bb1828a17d4d78cc60ca349..308c84dd13586c6d5d09d504fa4d3a14a452e7aa 100644
--- a/lib/api/files.rb
+++ b/lib/api/files.rb
@@ -67,7 +67,7 @@ module API
             file_path: blob.path,
             size: blob.size,
             encoding: "base64",
-            content: Base64.encode64(blob.data),
+            content: Base64.strict_encode64(blob.data),
             ref: ref,
             blob_id: blob.id,
             commit_id: commit.id,
diff --git a/spec/requests/api/files_spec.rb b/spec/requests/api/files_spec.rb
index 8cb8790c33972125d28d0b82b7769386974ecb85..042e6352567101f76dca133a1da1c4b5fcda0b97 100644
--- a/spec/requests/api/files_spec.rb
+++ b/spec/requests/api/files_spec.rb
@@ -117,4 +117,35 @@ describe API::API, api: true  do
       expect(response.status).to eq(400)
     end
   end
+
+  describe "POST /projects/:id/repository/files with binary file" do
+    let(:file_path) { 'test.bin' }
+    let(:put_params) do
+      {
+        file_path: file_path,
+        branch_name: 'master',
+        content: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=',
+        commit_message: 'Binary file with a \n should not be touched',
+        encoding: 'base64'
+      }
+    end
+    let(:get_params) do
+      {
+        file_path: file_path,
+        ref: 'master',
+      }
+    end
+
+    before do
+      post api("/projects/#{project.id}/repository/files", user), put_params
+    end
+
+    it "remains unchanged" do
+      get api("/projects/#{project.id}/repository/files", user), get_params
+      expect(response.status).to eq(200)
+      expect(json_response['file_path']).to eq(file_path)
+      expect(json_response['file_name']).to eq(file_path)
+      expect(json_response['content']).to eq(put_params[:content])
+    end
+  end
 end