mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[storage] correctly set content_length on save
This commit is contained in:
parent
3eb9ca98b8
commit
00171dfa8a
3 changed files with 15 additions and 0 deletions
|
@ -98,6 +98,11 @@ module Fog
|
||||||
|
|
||||||
data = connection.put_object(directory.key, @key, @body, options)
|
data = connection.put_object(directory.key, @key, @body, options)
|
||||||
merge_attributes(data.headers)
|
merge_attributes(data.headers)
|
||||||
|
if body.is_a?(String)
|
||||||
|
self.content_length = body.size
|
||||||
|
else
|
||||||
|
self.content_length = ::File.size(body.path)
|
||||||
|
end
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,11 @@ module Fog
|
||||||
|
|
||||||
data = connection.put_object(directory.key, @key, @body, options)
|
data = connection.put_object(directory.key, @key, @body, options)
|
||||||
merge_attributes(data.headers)
|
merge_attributes(data.headers)
|
||||||
|
if body.is_a?(String)
|
||||||
|
self.content_length = body.size
|
||||||
|
else
|
||||||
|
self.content_length = ::File.size(body.path)
|
||||||
|
end
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,11 @@ module Fog
|
||||||
requires :body, :directory, :key
|
requires :body, :directory, :key
|
||||||
data = connection.put_object(directory.key, @key, @body, options)
|
data = connection.put_object(directory.key, @key, @body, options)
|
||||||
merge_attributes(data.headers)
|
merge_attributes(data.headers)
|
||||||
|
if body.is_a?(String)
|
||||||
|
self.content_length = body.size
|
||||||
|
else
|
||||||
|
self.content_length = ::File.size(body.path)
|
||||||
|
end
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue