Use Rails-way to send file by X-Sendfile

This commit is contained in:
Tomasz Maczukin 2016-04-19 01:42:27 +02:00
parent d2dc139d0f
commit 0a13f5f864
No known key found for this signature in database
GPG Key ID: 7E9EB2E4B0F625CD
1 changed files with 2 additions and 5 deletions

View File

@ -63,14 +63,11 @@ class Projects::BuildsController < Projects::ApplicationController
end end
def raw def raw
response.headers['Content-Type'] = 'text/plain; charset=utf-8'
if @build.has_trace? if @build.has_trace?
response.headers['X-Sendfile'] = @build.path_to_trace send_file @build.path_to_trace, type: 'text/plain; charset=utf-8', disposition: 'inline'
else else
response.status = 404 render_404
end end
render nothing: true
end end
private private