簡體   English   中英

回形針在使用S3時提供錯誤的URL

[英]Paperclip providing wrong URL when using S3

正確的網址是: http : //s3.dvulgsolucoes.com.br/folder/filename.png,而我正在獲取此網址: http : //s3.dvulgsolucoes.com.br.s3.amazonaws.com/folder/ filename.png

config.paperclip_defaults = {
  storage: :s3,
  s3_credentials: {
    bucket: 'bucketname.com.br',
    access_key_id: '###',
    secret_access_key: '###',
  }
}

Paperclip::Attachment.default_options[:url] = ':s3_domain_url'
Paperclip::Attachment.default_options[:path] = '/clients/dmg/:class/:attachment/:id_partition/:style/:filename'

您可以從回形針更改默認的URL和路徑,在初始化程序上編輯paperclip.rb:

Paperclip::Attachment.default_options[:url] = ':s3_domain_url'
Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename'

您可以從Heroku檢查此鏈接

https://devcenter.heroku.com/articles/paperclip-s3#configuration

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM