用于 S3 私有文件的 ActiveStorage

ActiveStorage for S3 private files

到目前为止,我一直在使用 Paperclip 将一些文件上传到 S3。其中一些文件不是 public 并且 Paperclip 允许使用以下位上传一些私人文件:

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

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

Active Storage 中有什么可以调整的吗?

所有文件都是默认 ActiveStorage 的私有文件。 如果您希望能够使用 public acl(使用 public url)上传一些文件,以及使用私有 acl(到期 url)的其他文件,您可以使用我的 补丁 这里:https://gist.github.com/dinatih/dbfdfd4e84faac4037448a06c9fdc016

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