Permalink
Browse files

[storage] correctly set content_length on save

  • Loading branch information...
1 parent 3eb9ca9 commit 00171dfa8a2e2ac0c52768fe3b64418205bfa691 @geemus geemus committed Nov 17, 2010
@@ -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
@@ -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
@@ -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

0 comments on commit 00171df

Please sign in to comment.