Skip to content

Commit

Permalink
fix: read default acl from config
Browse files Browse the repository at this point in the history
  • Loading branch information
nerg4l committed Apr 1, 2024
1 parent 98cb962 commit d332514
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
15 changes: 15 additions & 0 deletions config/multipart-of-madness.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@

'storage_disk' => env('MULTIPART_OF_MADNESS_DISK', 's3'),

/*
|--------------------------------------------------------------------------
| Default ACL
|--------------------------------------------------------------------------
|
| This option controls the default ACL that will be used by the controller
| when signed URL needs to be created. You may set this to any of the
| canned ACLs available in AWS S3.
|
| https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl
|
*/

// 'acl' => 'public-read',

/*
|-------------------------------------
| Routes configurations
Expand Down
10 changes: 5 additions & 5 deletions src/Http/Controller/S3MultipartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ public function uploadParameters(Request $request)
'content-type' => $data['type'],
];

// TODO: read optional ACL from config

foreach ($data['metadata'] as $key => $value) {
$params["x-amz-meta-{$key}"] = $value;
if ($acl = config('multipart-of-madness.acl')) {
$params['ACL'] = $acl;
}

$key = implode('-', [Str::random(), $data['filename']]);
Expand Down Expand Up @@ -99,7 +97,9 @@ public function create(Request $request)
'Metadata' => $this->encodeMetadata($data['metadata']),
];

// TODO: read optional ACL from config
if ($acl = config('multipart-of-madness.acl')) {
$params['ACL'] = $acl;
}

$result = $this->adapter->createMultipartUpload($key, $params);

Expand Down

0 comments on commit d332514

Please sign in to comment.