1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[local|storage] properly write out file contents

This commit is contained in:
geemus 2010-11-22 14:20:45 -08:00
parent 492f960ff0
commit 73f5fdf9e7

View file

@ -45,7 +45,11 @@ module Fog
def save(options = {})
requires :body, :directory, :key
file = ::File.new(path, 'w')
file.write(body)
if body.is_a?(String)
file.write(body)
else
file.write(body.read)
end
file.close
merge_attributes(
:content_length => ::File.size(path),