From 01fcbc3afde8e892fd7f19162a6f4f081fb3f935 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Fri, 19 Sep 2014 20:26:04 +0200 Subject: [PATCH] fearure #3194: bug assembling the image file --- src/sunstone/sunstone-server.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sunstone/sunstone-server.rb b/src/sunstone/sunstone-server.rb index 25608cb71a..2b07a93941 100755 --- a/src/sunstone/sunstone-server.rb +++ b/src/sunstone/sunstone-server.rb @@ -529,7 +529,7 @@ post '/upload_chunk' do file_name = info['resumableIdentifier'] file_path = File.join(Dir.tmpdir, file_name) - tmpfile=env['rack.request.form_hash']['file'][:tempfile] + tmpfile=info['file'][:tempfile] begin chunk = tmpfile.read @@ -539,7 +539,7 @@ post '/upload_chunk' do "chunk.".to_json)] end - if File.exist? file_name + if File.exist? file_path mode = "r+" else mode = "w" @@ -550,6 +550,7 @@ post '/upload_chunk' do f.seek(chunk_start) f.write_nonblock(chunk) end + tmpfile.unlink rescue => e STDERR.puts e.backtrace return [500, OpenNebula::Error.new("Can not write to the temporary" \