mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-30 22:50:10 +03:00
Bug #1874: Fix upload of small files
This commit is contained in:
parent
1c7b1d5639
commit
9740bc364f
@ -392,7 +392,22 @@ end
|
||||
# Upload image
|
||||
##############################################################################
|
||||
post '/upload'do
|
||||
@SunstoneServer.upload(params[:img], request.env['rack.input'].path)
|
||||
|
||||
tmpfile = nil
|
||||
rackinput = request.env['rack.input']
|
||||
|
||||
if (rackinput.class == Tempfile)
|
||||
tmpfile = rackinput
|
||||
elsif (rackinput.class == StringIO)
|
||||
tmpfile = Tempfile.open('sunstone-upload')
|
||||
tmpfile.write rackinput.read
|
||||
tmpfile.flush
|
||||
else
|
||||
logger.error { "Unexpected rackinput class #{rackinput.class}" }
|
||||
return [500, ""]
|
||||
end
|
||||
|
||||
@SunstoneServer.upload(params[:img], tmpfile.path)
|
||||
end
|
||||
|
||||
##############################################################################
|
||||
|
Loading…
x
Reference in New Issue
Block a user