diff options
author | Tomasz Maczukin <tomasz@maczukin.pl> | 2016-06-21 13:12:02 +0200 |
---|---|---|
committer | Tomasz Maczukin <tomasz@maczukin.pl> | 2016-09-01 14:00:44 +0200 |
commit | ed51734030f94aa7e0636d8527b4bdae05c9de6b (patch) | |
tree | 6aeeeae96b529cffca2e0cf914e513686846422c | |
parent | 313b09fcbbef8ccccb43bf37320e14f59a631fdb (diff) | |
download | gitlab-ce-ed51734030f94aa7e0636d8527b4bdae05c9de6b.tar.gz |
Handle error on trace raw download with old builds (DB stored)
-rw-r--r-- | app/controllers/projects/builds_controller.rb | 2 | ||||
-rw-r--r-- | app/models/ci/build.rb | 4 | ||||
-rw-r--r-- | app/views/projects/builds/_sidebar.html.haml | 2 |
3 files changed, 6 insertions, 2 deletions
diff --git a/app/controllers/projects/builds_controller.rb b/app/controllers/projects/builds_controller.rb index 12195c3cbb8..4127337cbf2 100644 --- a/app/controllers/projects/builds_controller.rb +++ b/app/controllers/projects/builds_controller.rb @@ -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 diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 23c8de6f650..76142c4b2b6 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -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 diff --git a/app/views/projects/builds/_sidebar.html.haml b/app/views/projects/builds/_sidebar.html.haml index 5b0b58e087b..49c8bd11634 100644 --- a/app/views/projects/builds/_sidebar.html.haml +++ b/app/views/projects/builds/_sidebar.html.haml @@ -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 |