summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-09-06 15:55:35 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-09-06 15:55:35 +0000
commitba39b26cc2f1ace540177c3b73d64d40b06bc902 (patch)
tree74691ce0b45a6b2d35efc58cdbfa460dc0ddef22 /lib/api
parent93e1d4dd285c657a3abb09dff7f86e552b0097f2 (diff)
parent46f6092a6d4dd39bfa193d0a6ccbd5688df7eebe (diff)
downloadgitlab-ce-ba39b26cc2f1ace540177c3b73d64d40b06bc902.tar.gz
Merge branch '35942_api_binary_encoding' into 'master'
API fix for non UTF-8 data Closes #35942 See merge request !14038
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/commits.rb2
-rw-r--r--lib/api/entities.rb3
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/api/commits.rb b/lib/api/commits.rb
index ea78737288a..4b8d248f5f7 100644
--- a/lib/api/commits.rb
+++ b/lib/api/commits.rb
@@ -104,7 +104,7 @@ module API
not_found! 'Commit' unless commit
- commit.raw_diffs.to_a
+ present commit.raw_diffs.to_a, with: Entities::RepoDiff
end
desc "Get a commit's comments" do
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 9114b69606b..1d224d7bc21 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -291,10 +291,11 @@ module API
end
class RepoDiff < Grape::Entity
- expose :old_path, :new_path, :a_mode, :b_mode, :diff
+ expose :old_path, :new_path, :a_mode, :b_mode
expose :new_file?, as: :new_file
expose :renamed_file?, as: :renamed_file
expose :deleted_file?, as: :deleted_file
+ expose :json_safe_diff, as: :diff
end
class ProtectedRefAccess < Grape::Entity