问题
Until now I was using Paperclip for uploading some files to S3. Some of these files are not public and Paperclip allowed to upload some files as private with the following bit :
has_attached_file :image, styles: { large: "2000x2000", small: "1200x1200", thumb: "250x250"}, :s3_permissions => :private
Now Paperclip is deprecated I am considering switching to Active Storage though I have not found any option to make some of my files private.
Is there something to tweak in Active Storage to allow this ?
回答1:
All the files are privates with the default ActiveStorage. If you want to be able to upload some files with public acl (with public url), and others with private acl (with expiring url) you can use my patch here : https://gist.github.com/dinatih/dbfdfd4e84faac4037448a06c9fdc016
from this comment : https://github.com/rails/rails/issues/31419#issuecomment-370900013
来源:https://stackoverflow.com/questions/50719769/activestorage-for-s3-private-files