s3-edit icon indicating copy to clipboard operation
s3-edit copied to clipboard

Editing a file resets the ACL

Open benwad opened this issue 7 years ago • 2 comments

First of all, great tool! I love the editor integration, makes everything really easy.

The issue I'm getting is that editing a file with the public-read ACL then saving it results in the file no longer being publicly accessible.

Steps to reproduce:

  1. Create a file on a bucket, give it the public-read canned ACL.
  2. Edit this file with s3-edit, save it.
  3. Attempt to view the file unauthenticated from its URL.

benwad avatar Jan 10 '18 16:01 benwad

Thank you for your report, and sorry for late confirmation.

I confirmed that it reproduced by the method you introduced. And I understood the cause.

I will consider measures.

tsub avatar Feb 17 '18 06:02 tsub

I thought about measures, but it is difficult. Implementation may take time.

The reasons are described below.

The issue I'm getting is that editing a file with the public-read ACL then saving it results in the file no longer being publicly accessible.

The reason is that ACL is initialized when PutObject API is executed. Therefore, the countermeasure method is to acquire the previous ACL using the GetObjectAcl API and specify it when using the PutObject API.

However, the return value of GetObjectAcl API and the argument structure of PuObject API are quite different in aws-sdk-go.

Therefore, it is difficult to interpret the return value of GetObjectAcl API yourself and pass it as an argument of PutObject API.

The following is the document of aws-sdk-go.

  • https://docs.aws.amazon.com/sdk-for-go/api/service/s3/#GetObjectAclOutput
  • https://docs.aws.amazon.com/sdk-for-go/api/service/s3/#PutObjectInput
  • https://docs.aws.amazon.com/sdk-for-go/api/service/s3/#PutObjectAclInput

tsub avatar Feb 17 '18 07:02 tsub