lib/rbbt/rest/workflow/stream_task.rb in rbbt-rest-1.8.11 vs lib/rbbt/rest/workflow/stream_task.rb in rbbt-rest-1.8.12
- old
+ new
@@ -54,14 +54,17 @@
[inputs, filename]
end
def copy_until_boundary(sin, sout, boundary)
+ last_line = nil
while line = sin.gets
break if line.include? boundary
- sout.write line
+ sout.write last_line
+ last_line = line
end
+ sout.write last_line.strip unless last_line == EOL
end
def get_inputs(content_type, stream)
boundary = content_type.match(/boundary=([^\s;]*)/)[1]
stream_input = content_type.match(/stream=([^\s;]*)/)[1]
@@ -77,10 +80,14 @@
task_parameters = prepare_job_inputs(workflow, task, inputs)
Misc.add_stream_filename(stream, filename) if filename
- task_parameters[stream_input] = stream
+ clean_stream = Misc.open_pipe do |sin|
+ copy_until_boundary(stream, sin, boundary)
+ end
+
+ task_parameters[stream_input] = clean_stream
task = task.to_sym
job = workflow.job(task, name, task_parameters)