summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-05-18 16:05:11 +0900
committerShinya Maeda <shinya@gitlab.com>2018-05-21 19:35:46 +0900
commit5af5815d62f3430c52bb489c590eaa32402b18fa (patch)
tree8c7266ff998857e4dc2e645de29d66d999c1a892
parent93349b4440add0da70f87026ae434be5c10f1ad1 (diff)
downloadgitlab-ce-5af5815d62f3430c52bb489c590eaa32402b18fa.tar.gz
Add the same gurad clause with artifacts uplaoding
-rw-r--r--lib/api/runner.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/api/runner.rb b/lib/api/runner.rb
index a4df98cadac..a7f1cb1131f 100644
--- a/lib/api/runner.rb
+++ b/lib/api/runner.rb
@@ -149,6 +149,7 @@ module API
end
patch '/:id/trace' do
job = authenticate_job!
+ forbidden!('Job is not running') unless job.running?
error!('400 Missing header Content-Range', 400) unless request.headers.key?('Content-Range')
content_range = request.headers['Content-Range']
@@ -165,7 +166,7 @@ module API
body_start = content_range[0].to_i
body_end = body_start + body_data.bytesize
- stream_size = job.trace.append(body_data, body_start) if job.running?
+ stream_size = job.trace.append(body_data, body_start)
unless stream_size == body_end
break error!('416 Range Not Satisfiable', 416, { 'Range' => "0-#{stream_size}" })
end