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

This commit is contained in:
Tomasz Maczukin 2016-06-21 13:12:02 +02:00
parent 313b09fcbb
commit ed51734030
No known key found for this signature in database
GPG Key ID: 7E9EB2E4B0F625CD
3 changed files with 6 additions and 2 deletions

View File

@ -78,7 +78,7 @@ class Projects::BuildsController < Projects::ApplicationController
end
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'
else
render_404

View File

@ -208,6 +208,10 @@ module Ci
end
end
def has_trace_file?
File.exist?(path_to_trace) || (project.ci_id && File.exist?(old_path_to_trace))
end
def has_trace?
raw_trace.present?
end

View File

@ -100,7 +100,7 @@
- elsif @build.runner
\##{@build.runner.id}
.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'
- if @build.active?
= link_to "Cancel", cancel_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default', method: :post