Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[storage] correctly set content_length on save

  • Loading branch information...
commit 00171dfa8a2e2ac0c52768fe3b64418205bfa691 1 parent 3eb9ca9
@geemus geemus authored
View
5 lib/fog/aws/models/storage/file.rb
@@ -98,6 +98,11 @@ def save(options = {})
data = connection.put_object(directory.key, @key, @body, options)
merge_attributes(data.headers)
+ if body.is_a?(String)
+ self.content_length = body.size
+ else
+ self.content_length = ::File.size(body.path)
+ end
true
end
View
5 lib/fog/google/models/storage/file.rb
@@ -100,6 +100,11 @@ def save(options = {})
data = connection.put_object(directory.key, @key, @body, options)
merge_attributes(data.headers)
+ if body.is_a?(String)
+ self.content_length = body.size
+ else
+ self.content_length = ::File.size(body.path)
+ end
true
end
View
5 lib/fog/rackspace/models/storage/file.rb
@@ -52,6 +52,11 @@ def save(options = {})
requires :body, :directory, :key
data = connection.put_object(directory.key, @key, @body, options)
merge_attributes(data.headers)
+ if body.is_a?(String)
+ self.content_length = body.size
+ else
+ self.content_length = ::File.size(body.path)
+ end
true
end
Please sign in to comment.
Something went wrong with that request. Please try again.