Commit ed517340 authored by Tomasz Maczukin's avatar Tomasz Maczukin

Handle error on trace raw download with old builds (DB stored)

parent 313b09fc
...@@ -78,7 +78,7 @@ class Projects::BuildsController < Projects::ApplicationController ...@@ -78,7 +78,7 @@ class Projects::BuildsController < Projects::ApplicationController
end end
def raw def raw
if @build.has_trace? if @build.has_trace_file?
send_file @build.path_to_trace, type: 'text/plain; charset=utf-8', disposition: 'inline' send_file @build.path_to_trace, type: 'text/plain; charset=utf-8', disposition: 'inline'
else else
render_404 render_404
......
...@@ -208,6 +208,10 @@ module Ci ...@@ -208,6 +208,10 @@ module Ci
end end
end end
def has_trace_file?
File.exist?(path_to_trace) || (project.ci_id && File.exist?(old_path_to_trace))
end
def has_trace? def has_trace?
raw_trace.present? raw_trace.present?
end end
......
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
- elsif @build.runner - elsif @build.runner
\##{@build.runner.id} \##{@build.runner.id}
.btn-group.btn-group-justified{ role: :group } .btn-group.btn-group-justified{ role: :group }
- if @build.has_trace? - if @build.has_trace_file?
= link_to 'Raw', raw_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' = link_to 'Raw', raw_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default'
- if @build.active? - if @build.active?
= link_to "Cancel", cancel_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default', method: :post = link_to "Cancel", cancel_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default', method: :post
......
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