Skip to content

Storage S3: Public Read ACL #97

Description

@calmdev

I was trying the storage s3 plugin with digital ocean which is working, but noticed that all uploaded files are private by default. So when the files upload they appear broken on the website. Adding an ACL with value public-read fixes the permissions issue allowing the s3 files to load:

diff --git a/storage-s3/s3_client.go b/storage-s3/s3_client.go
index 445e1dd..332625a 100644
--- a/storage-s3/s3_client.go
+++ b/storage-s3/s3_client.go
@@ -55,6 +55,7 @@ func (s *Client) PutObject(key, ext string, file io.ReadSeeker) (err error) {
        }
        contentType := fmt.Sprintf("image/%s", strings.TrimPrefix(ext, "."))
        _, err = s3.New(newSession).PutObject(&s3.PutObjectInput{
+               ACL:         aws.String("public-read"),
                Body:        file,
                Bucket:      aws.String(s.bucket),
                Key:         aws.String(key),

No ACL:

no-acl.mov

With ACL:

with-acl.mov

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions