From 3c742dad27d298fae9aa8ee68cf1a83178fb8704 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 18 Feb 2014 11:40:45 +0200 Subject: [PATCH] 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: Dmitriy Zaporozhets --- lib/api/api.rb | 2 ++ lib/api/repositories.rb | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/api/api.rb b/lib/api/api.rb index 283f7642f67..9022cf7375a 100644 --- a/lib/api/api.rb +++ b/lib/api/api.rb @@ -22,6 +22,8 @@ module API end format :json + content_type :txt, "text/plain" + helpers APIHelpers mount Groups diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb index cad64760abb..c305c889fc2 100644 --- a/lib/api/repositories.rb +++ b/lib/api/repositories.rb @@ -167,9 +167,7 @@ module API blob = Gitlab::Git::Blob.find(repo, commit.id, params[:filepath]) not_found! "File" unless blob - env['api.format'] = :txt - - content_type blob.mime_type + content_type 'text/plain' present blob.data end