Editing a file resets the ACL
benwad opened this issue · 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:
- Create a file on a bucket, give it the
public-read
canned ACL. - Edit this file with s3-edit, save it.
- Attempt to view the file unauthenticated from its URL.
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.
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.