[aws|put_object] do not check user meta data encoding for ruby-1.8.7

- There is no `Encoding` module in `ruby-1.8.7`
- `fog v2` will drop support for `ruby-1.8.7`
- Simply revert this commit once support for `ruby-1.8.7`is dropped
This commit is contained in:
Jan Raasch 2014-12-15 14:27:07 +01:00
parent f21daa6589
commit 323b8439c9
2 changed files with 11 additions and 2 deletions

View File

@ -26,6 +26,7 @@ module Fog
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectPUT.html
def self.conforming_to_us_ascii!(keys, hash)
return if RUBY_VERSION =~ /^1\.8\./
keys.each do |k|
v = hash[k]
if !v.encode(::Encoding::US_ASCII, :undef => :replace).eql?(v)

View File

@ -18,6 +18,12 @@ Shindo.tests('AWS::Storage | object requests', ['aws']) do
Fog::Storage[:aws].put_object(@directory.identity, 'fog_object', lorem_file)
end
if RUBY_VERSION =~ /^1\.8\./
tests("#put_object('#{@directory.identity}', 'fog_object', lorem_file, {'x-amz-meta-json' => 'ä'}").succeeds do
Fog::Storage[:aws].put_object(@directory.identity, 'fog_object', lorem_file, {'x-amz-meta-json' => 'ä'})
end
end
tests("#copy_object('#{@directory.identity}', 'fog_object', '#{@directory.identity}', 'fog_other_object')").succeeds do
Fog::Storage[:aws].copy_object(@directory.identity, 'fog_object', @directory.identity, 'fog_other_object')
end
@ -126,8 +132,10 @@ Shindo.tests('AWS::Storage | object requests', ['aws']) do
Fog::Storage[:aws].put_object(fognonbucket, 'fog_non_object', lorem_file)
end
tests("#put_object('#{@directory.identity}', 'fog_object', lorem_file, {'x-amz-meta-json' => 'ä'}").raises(Excon::Errors::BadRequest) do
Fog::Storage[:aws].put_object(@directory.identity, 'fog_object', lorem_file, {'x-amz-meta-json' => 'ä'})
unless RUBY_VERSION =~ /^1\.8\./
tests("#put_object('#{@directory.identity}', 'fog_object', lorem_file, {'x-amz-meta-json' => 'ä'}").raises(Excon::Errors::BadRequest) do
Fog::Storage[:aws].put_object(@directory.identity, 'fog_object', lorem_file, {'x-amz-meta-json' => 'ä'})
end
end
tests("#copy_object('#{fognonbucket}', 'fog_object', '#{@directory.identity}', 'fog_other_object')").raises(Excon::Errors::NotFound) do