From e01c421b911a46774f8c5be92d383d8da14750c3 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Thu, 14 Jul 2016 16:36:09 +0800 Subject: [PATCH] Prefer if so it's more clear what's going on --- lib/api/builds.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/api/builds.rb b/lib/api/builds.rb index f6e96ee7f3a..b3b28541382 100644 --- a/lib/api/builds.rb +++ b/lib/api/builds.rb @@ -69,16 +69,17 @@ module API authorize_read_builds! build = get_build!(params[:build_id]) - artifacts_file = build.artifacts_file - unless artifacts_file.file_storage? - return redirect_to build.artifacts_file.url + if !artifacts_file.file_storage? + redirect_to(build.artifacts_file.url) + + elsif artifacts_file.exists? + present_file!(artifacts_file.path, artifacts_file.filename) + + else + not_found! end - - return not_found! unless artifacts_file.exists? - - present_file!(artifacts_file.path, artifacts_file.filename) end # Get a trace of a specific build of a project