Commit 3c742dad authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fixed bug with json files content being escaped in api

After update to recent grape env['api.format'] does not work any more.
Use content_type for rendering raw json files content
Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 87a449f2
...@@ -22,6 +22,8 @@ module API ...@@ -22,6 +22,8 @@ module API
end end
format :json format :json
content_type :txt, "text/plain"
helpers APIHelpers helpers APIHelpers
mount Groups mount Groups
......
...@@ -167,9 +167,7 @@ module API ...@@ -167,9 +167,7 @@ module API
blob = Gitlab::Git::Blob.find(repo, commit.id, params[:filepath]) blob = Gitlab::Git::Blob.find(repo, commit.id, params[:filepath])
not_found! "File" unless blob not_found! "File" unless blob
env['api.format'] = :txt content_type 'text/plain'
content_type blob.mime_type
present blob.data present blob.data
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment