简体   繁体   English

回形针在使用S3时提供错误的URL

[英]Paperclip providing wrong URL when using S3

The correct url is: http://s3.dvulgsolucoes.com.br/folder/filename.png and I'm getting this url: http://s3.dvulgsolucoes.com.br.s3.amazonaws.com/folder/filename.png 正确的网址是: 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'

You can change the default URL and path from paperclip, editing paperclip.rb on initializer: 您可以从回形针更改默认的URL和路径,在初始化程序上编辑paperclip.rb:

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

You can check this link from Heroku 您可以从Heroku检查此链接

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM