diff --git a/lib/fog/aws/models/storage/file.rb b/lib/fog/aws/models/storage/file.rb index 3c835b540..f6de0bd57 100644 --- a/lib/fog/aws/models/storage/file.rb +++ b/lib/fog/aws/models/storage/file.rb @@ -98,6 +98,11 @@ module Fog 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 diff --git a/lib/fog/google/models/storage/file.rb b/lib/fog/google/models/storage/file.rb index 5aa9d0515..12a333cbc 100644 --- a/lib/fog/google/models/storage/file.rb +++ b/lib/fog/google/models/storage/file.rb @@ -100,6 +100,11 @@ module Fog 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 diff --git a/lib/fog/rackspace/models/storage/file.rb b/lib/fog/rackspace/models/storage/file.rb index 09c8331f4..27ef5e31f 100644 --- a/lib/fog/rackspace/models/storage/file.rb +++ b/lib/fog/rackspace/models/storage/file.rb @@ -52,6 +52,11 @@ module Fog 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