【问题标题】:ActiveStorage for S3 private files用于 S3 私有文件的 ActiveStorage
【发布时间】:2018-11-16 02:27:10
【问题描述】:

到目前为止,我一直在使用 Paperclip 将一些文件上传到 S3。其中一些文件不是公开的,Paperclip 允许通过以下位将一些文件作为私有文件上传:

has_attached_file :image, styles: { large: "2000x2000", small: "1200x1200", thumb: "250x250"}, :s3_permissions => :private

现在 Paperclip 已被弃用,我正在考虑切换到 Active Storage,尽管我还没有找到任何选项可以将我的某些文件设为私有。

是否需要在 Active Storage 中进行调整以允许这样做?

【问题讨论】:

    标签: ruby-on-rails rails-activestorage ruby-on-rails-5.2


    【解决方案1】:

    所有文件都是私有的,具有默认的 ActiveStorage。 如果您希望能够上传一些带有公共 acl(带有公共 url)的文件,以及其他带有私有 acl(带有过期 url)的文件,您可以在这里使用我的 patchhttps://gist.github.com/dinatih/dbfdfd4e84faac4037448a06c9fdc016

    来自此评论:https://github.com/rails/rails/issues/31419#issuecomment-370900013

    【讨论】:

      猜你喜欢
      • 2019-02-18
      • 2018-04-24
      • 1970-01-01
      • 2019-05-13
      • 1970-01-01
      • 2019-07-23
      • 2021-03-30
      • 2021-04-12
      • 2012-10-11
      相关资源
      最近更新 更多