Switch raw trace to use X-Sendfile header
This commit is contained in:
parent
27d1349f2b
commit
bf4371d60d
2 changed files with 7 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
||||||
class Projects::BuildsController < Projects::ApplicationController
|
class Projects::BuildsController < Projects::ApplicationController
|
||||||
before_action :build, except: [:index, :cancel_all]
|
before_action :build, except: [:index, :cancel_all]
|
||||||
before_action :authorize_read_build!, except: [:cancel, :cancel_all, :retry]
|
before_action :authorize_read_build!, except: [:cancel, :cancel_all, :retry]
|
||||||
before_action :authorize_update_build!, except: [:index, :show, :status, :raw_trace]
|
before_action :authorize_update_build!, except: [:index, :show, :status, :raw]
|
||||||
layout 'project'
|
layout 'project'
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@ -63,11 +63,14 @@ class Projects::BuildsController < Projects::ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def raw
|
def raw
|
||||||
|
response.headers['Content-Typei'] = 'text/plain'
|
||||||
if @build.has_trace?
|
if @build.has_trace?
|
||||||
render json: { trace_file: @build.path_to_trace }
|
response.headers['X-Sendfile'] = @build.path_to_trace
|
||||||
else
|
else
|
||||||
render json: {}, status: 404
|
response.status = 404
|
||||||
end
|
end
|
||||||
|
|
||||||
|
render nothing: true
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -669,7 +669,7 @@ Rails.application.routes.draw do
|
||||||
post :cancel
|
post :cancel
|
||||||
post :retry
|
post :retry
|
||||||
post :erase
|
post :erase
|
||||||
get :raw, format: false
|
get :raw
|
||||||
end
|
end
|
||||||
|
|
||||||
resource :artifacts, only: [] do
|
resource :artifacts, only: [] do
|
||||||
|
|
Loading…
Reference in a new issue