带有回形针的s3对象的错误路径

时间:2018-12-18 13:58:46

标签: amazon-s3 paperclip spree

我有一个与此issue类似的问题,但是我的狂欢版本是3.0和回形针4.2

我想覆盖回形针附件的default_options

attachment_config = {
        s3_credentials: {
            access_key_id: ENV["AWS_ACCESS_KEY_ID"],
            secret_access_key: ENV["AWS_SECRET_ACCESS_KEY"],
            bucket: ENV["S3_BUCKET_NAME"],
        },

        storage:        :s3,
        s3_headers:     { "Cache-Control" => "max-age=31557600" },
        s3_protocol:    "https",
        s3_region:      ENV['AWS_REGION'],
        s3_host_name:   ENV['AWS_ENDPOINT'],
        bucket:         ENV["S3_BUCKET_NAME"],

        path:          "app/:class/:attachment/:id/:style/:basename.:extension",
        default_url:   "/:class/:attachment/:id/:style/:basename.:extension",
        default_style: "product",
    }

    attachment_config.each do |key, value|
      #Spree::Image.attachment_definitions[:attachment][key.to_sym] = value
      Paperclip::Attachment.default_options[key.to_sym] = value
    end

问题是我仍然收到错误的路径

必须是:

0 个答案:

没有答案