我在 Rails 3 中设置了我的 S3 帐户,如下所示:
AWS::S3::DEFAULT_HOST.replace "s3-eu-west-1.amazonaws.com"
#Set up AWS S3
AWS::S3::Base.establish_connection!(
:access_key_id => 'itsa',
:secret_access_key => 'secret'
)
BUCKET='wetten'
但由于某种原因,它说我的文件不存在。我已授予“所有人”对 S3 中文件的打开/下载权限。
在 Rails 控制台中,对于这个文件:
>> AWS::S3::S3Object.exists?('/xml/BWBR0001821.xml', 'wetten')
true
>> AWS::S3::S3Object.find('/xml/BWBR0001821.xml', 'wetten')
AWS::S3::NoSuchKey: No such key `/xml/BWBR0001821.xml'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/aws-s3-0.6.3/lib/aws/s3/object.rb:177:in `find'
from (irb):11
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/commands/console.rb:47:in `start'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/commands/console.rb:8:in `start'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:41:in `<top (required)>'
from C:/Users/Maarten/RubymineProjects/wetten-api/script/rails:6:in `require'
from C:/Users/Maarten/RubymineProjects/wetten-api/script/rails:6:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
怎么了?
更新:我注意到在 object.rb 中,AWS S3 gem (v0.6.3) 执行以下操作:
bucket = Bucket.find(bucket_name(bucket), :marker => key.previous, :max_keys => 1)
在哪里,并且key
是... 什么鬼?这对我来说似乎是一个错误。'/xml/BWBR0001821.xml'
key.previous
'/xml/BWBR0001821.xmk'