mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[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:
parent
f21daa6589
commit
323b8439c9
2 changed files with 11 additions and 2 deletions
|
@ -26,6 +26,7 @@ module Fog
|
||||||
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectPUT.html
|
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectPUT.html
|
||||||
|
|
||||||
def self.conforming_to_us_ascii!(keys, hash)
|
def self.conforming_to_us_ascii!(keys, hash)
|
||||||
|
return if RUBY_VERSION =~ /^1\.8\./
|
||||||
keys.each do |k|
|
keys.each do |k|
|
||||||
v = hash[k]
|
v = hash[k]
|
||||||
if !v.encode(::Encoding::US_ASCII, :undef => :replace).eql?(v)
|
if !v.encode(::Encoding::US_ASCII, :undef => :replace).eql?(v)
|
||||||
|
|
|
@ -18,6 +18,12 @@ Shindo.tests('AWS::Storage | object requests', ['aws']) do
|
||||||
Fog::Storage[:aws].put_object(@directory.identity, 'fog_object', lorem_file)
|
Fog::Storage[:aws].put_object(@directory.identity, 'fog_object', lorem_file)
|
||||||
end
|
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
|
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')
|
Fog::Storage[:aws].copy_object(@directory.identity, 'fog_object', @directory.identity, 'fog_other_object')
|
||||||
end
|
end
|
||||||
|
@ -126,9 +132,11 @@ Shindo.tests('AWS::Storage | object requests', ['aws']) do
|
||||||
Fog::Storage[:aws].put_object(fognonbucket, 'fog_non_object', lorem_file)
|
Fog::Storage[:aws].put_object(fognonbucket, 'fog_non_object', lorem_file)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
unless RUBY_VERSION =~ /^1\.8\./
|
||||||
tests("#put_object('#{@directory.identity}', 'fog_object', lorem_file, {'x-amz-meta-json' => 'ä'}").raises(Excon::Errors::BadRequest) do
|
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' => 'ä'})
|
Fog::Storage[:aws].put_object(@directory.identity, 'fog_object', lorem_file, {'x-amz-meta-json' => 'ä'})
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
tests("#copy_object('#{fognonbucket}', 'fog_object', '#{@directory.identity}', 'fog_other_object')").raises(Excon::Errors::NotFound) do
|
tests("#copy_object('#{fognonbucket}', 'fog_object', '#{@directory.identity}', 'fog_other_object')").raises(Excon::Errors::NotFound) do
|
||||||
Fog::Storage[:aws].copy_object(fognonbucket, 'fog_object', @directory.identity, 'fog_other_object')
|
Fog::Storage[:aws].copy_object(fognonbucket, 'fog_object', @directory.identity, 'fog_other_object')
|
||||||
|
|
Loading…
Reference in a new issue