2
嗨「S3」我得到了下面的某些路徑配置:了S3 ::錯誤:: SignatureDoesNotMatch通過使用回形針對某些路徑配置
S3::Error::SignatureDoesNotMatch (The request signature we calculated does not match the signature you provided. Check your key and signing method.):
config/initializers/paperclip_2_s3.rb:124:in `block in flush_writes'
config/initializers/paperclip_2_s3.rb:113:in `each'
config/initializers/paperclip_2_s3.rb:113:in `flush_writes'
app/controllers/admin/images_controller.rb:12:in `create'
has_mongoid_attached_file :photo,
:styles => { :thumb => "120x120#" },
:convert_options => { :all => "-quality 92 +profile '!icc,*'" },
:storage => :s3,
# :path => '/:class/:attachment/:style/:basename.:extension',
:path => ':class/:attachment/:id_partition/:basename.:style.:extension',
:url => ':s3_domain_url',
:s3_credentials => {
:access_key_id => ApplicationController.aws_access_key,
:secret_access_key => ApplicationController.aws_secret_access_key
},
:bucket => proc { |attachment| if attachment.instance.imagable.respond_to? (:domain) then ApplicationController.bucket_name(attachment.instance.imagable.domain) else ApplicationController.bucket_name(attachment.instance.imagable.site.domain) end }
如果我更改配置爲這一個:
has_mongoid_attached_file :photo,
:styles => { :thumb => "120x120#" },
:convert_options => { :all => "-quality 92 +profile '!icc,*'" },
:storage => :s3,
# :path => '/:class/:attachment/:style/:basename.:extension',
:path => ':class/:attachment/:id_partition/:basename.:style.:extension',
:url => ':s3_domain_url',
:s3_credentials => {
:access_key_id => ApplicationController.aws_access_key,
:secret_access_key => ApplicationController.aws_secret_access_key
},
:bucket => proc { |attachment| if attachment.instance.imagable.respond_to? (:domain) then ApplicationController.bucket_name(attachment.instance.imagable.domain) else ApplicationController.bucket_name(attachment.instance.imagable.site.domain) end }
然後一切都很好....
所以我只更改了存儲路徑
# :path => '/:class/:attachment/:style/:basename.:extension',
:path => ':class/:attachment/:id_partition/:basename.:style.:extension',
這工作也:
:path => ':class/:attachment/:id_partition/:basename:style.:extension',
任何人能解釋一下嗎?
另一個有趣的事情:
:path => '/:id_partition/:basename.:extension',
在這種情況下,我也拿到了這一點:
URI::InvalidURIError (the scheme does not accept registry part: 4e5e (or bad hostname?)):
任何解釋,歡迎... :)