Eduardo Álvarez
Eduardo Álvarez

Reputation: 353

Rails 6 Active Storage: Digital Ocean Spaces does not honor public-read ACL

I'm using Rails 6 Active Storage to upload images to a Digital Ocean Spaces bucket.

My Storage.yml:

digitalocean:
   service: S3
   access_key_id: <%= Credential.digitalocean_access_key_id %>
   secret_access_key: <%= Credential.digitalocean_secret_access_key %>
   endpoint: https://sfo2.digitaloceanspaces.com
   region: sfo2
   bucket: mybucket
   upload:
     acl: "public-read"   

As you can see I do specify a "public-read" upload ACL.

Images do upload fine using Active Storage direct upload, yet in the bucket, the file permission is Private, not Public.

Any help is appreciated, thank you.

Upvotes: 1

Views: 613

Answers (1)

alispat
alispat

Reputation: 65

I guess it's an issue with Digital Ocean S3 implementation! Try this command to force ACL to public:

s3cmd --access_key=YOUR_ACCESS_KEY--secret_key=YOUR_SECRET_KEY --host=YOUR_BUCKET_REGION.digitaloceanspaces.com --host-bucket=YOUR_BUCKET_NAME.YOUR_BUCKET_REGION.digitaloceanspaces.com --region=YOUR_BUCKET_REGION setacl s3://YOUR_BUCKET_NAME --acl-public

Upvotes: 1

Related Questions