Commit d6b18d39 authored by Shinya Maeda's avatar Shinya Maeda

Fix

parent 9b7a0533
...@@ -119,20 +119,22 @@ class Projects::JobsController < Projects::ApplicationController ...@@ -119,20 +119,22 @@ class Projects::JobsController < Projects::ApplicationController
end end
def raw def raw
build.trace.read do |stream|
if trace_artifact_file if trace_artifact_file
send_upload(trace_artifact_file, send_upload(trace_artifact_file,
send_params: { type: 'text/plain; charset=utf-8', disposition: 'inline' }, send_params: raw_send_params,
redirect_params: { query: { 'response-content-type' => 'text/plain; charset=utf-8', 'response-content-disposition' => 'inline' } } ) redirect_params: raw_redirect_params)
elsif stream.file? else
build.trace.read do |stream|
if stream.file?
send_file stream.path, type: 'text/plain; charset=utf-8', disposition: 'inline' send_file stream.path, type: 'text/plain; charset=utf-8', disposition: 'inline'
elsif build.old_trace elsif build.old_trace
send_data stream.path, type: 'text/plain; charset=utf-8', disposition: 'inline', filename: 'job.log' send_data stream.raw, type: 'text/plain; charset=utf-8', disposition: 'inline', filename: 'job.log'
else else
render_404 render_404
end end
end end
end end
end
private private
...@@ -144,6 +146,14 @@ class Projects::JobsController < Projects::ApplicationController ...@@ -144,6 +146,14 @@ class Projects::JobsController < Projects::ApplicationController
return access_denied! unless can?(current_user, :erase_build, build) return access_denied! unless can?(current_user, :erase_build, build)
end end
def raw_send_params
{ type: 'text/plain; charset=utf-8', disposition: 'inline' }
end
def raw_redirect_params
{ query: { 'response-content-type' => 'text/plain; charset=utf-8', 'response-content-disposition' => 'inline' } }
end
def trace_artifact_file def trace_artifact_file
@trace_artifact_file ||= build.job_artifacts_trace&.file @trace_artifact_file ||= build.job_artifacts_trace&.file
end end
......
...@@ -22,7 +22,7 @@ module Gitlab ...@@ -22,7 +22,7 @@ module Gitlab
end end
def file? def file?
self.path.present? if self.respond_to(:path) self.path.present? if respond_to?(:path)
end end
def limit(last_bytes = LIMIT_SIZE) def limit(last_bytes = LIMIT_SIZE)
......
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