feat: Content Disposition and ACL support

This commit adds two extra fields to the upload input
to add support for setting Content-Disposition and the
x-amz-acl params.
This commit is contained in:
Rohan Verma
2021-01-27 09:20:07 +05:30
committed by Rohan Verma
parent f8d50ad6a3
commit 7be0d9e563
2 changed files with 32 additions and 10 deletions
+14 -6
View File
@@ -43,11 +43,17 @@ type DownloadInput struct {
// UploadInput is passed to FileUpload as a parameter.
type UploadInput struct {
// essential fields
Bucket string
ObjectKey string
FileName string
ContentType string
Body io.ReadSeeker
// optional fields
ContentDisposition string
ACL string
Body io.ReadSeeker
}
// UploadResponse receives the following XML
@@ -288,11 +294,13 @@ func (s3 *S3) FileUpload(u UploadInput) (UploadResponse, error) {
return UploadResponse{}, err
}
policies, err := s3.CreateUploadPolicies(UploadConfig{
UploadURL: s3.getURL(u.Bucket),
BucketName: u.Bucket,
ObjectKey: u.ObjectKey,
ContentType: u.ContentType,
FileSize: fSize,
UploadURL: s3.getURL(u.Bucket),
BucketName: u.Bucket,
ObjectKey: u.ObjectKey,
ContentType: u.ContentType,
ContentDisposition: u.ContentDisposition,
ACL: u.ACL,
FileSize: fSize,
MetaData: map[string]string{
"success_action_status": "201", // returns XML doc on success
},