diff options
author | Tomasz Maczukin <tomasz@maczukin.pl> | 2016-04-09 02:21:18 +0300 |
---|---|---|
committer | Tomasz Maczukin <tomasz@maczukin.pl> | 2016-04-20 12:53:44 +0300 |
commit | dd29283a880dd5b02c462777e18b2bc29ab7ce97 (patch) | |
tree | 8b64ea46285c4a4b48928b0c420a129054f83cbb /lib | |
parent | 360bd831bfe40f3c44e35d884c32fa49fede87ab (diff) |
Make sure that appending is done on a valid length
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ci/api/builds.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/ci/api/builds.rb b/lib/ci/api/builds.rb index decee3739c8..776129d90e0 100644 --- a/lib/ci/api/builds.rb +++ b/lib/ci/api/builds.rb @@ -50,6 +50,16 @@ module Ci end end + # Send incremental log update - Runners only + # + # Parameters: + # id (required) - The ID of a build + # Body: + # content of logs to append + # Headers: + # Content-Range: range of conntent that was sent + # Example Request: + # PATCH /builds/:id/trace.txt patch ":id/trace.txt" do build = Ci::Build.find_by_id(params[:id]) not_found! unless build @@ -64,7 +74,7 @@ module Ci return error!('416 Range Not Satisfiable', 416, { 'Range' => "0-#{build.trace_length}" }) end - build.append_trace(request.body.read) + build.append_trace(request.body.read, content_range[0].to_i) status 202 header 'Build-Status', build.status |