Skip to content

Commit

Permalink
allow acl to be null
Browse files Browse the repository at this point in the history
  • Loading branch information
nadar committed Jun 26, 2024
1 parent 522c2f1 commit 4d23c0d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
In order to read more about upgrading and BC breaks have a look at the [UPGRADE Document](UPGRADE.md).

## 1.7.0

+ allow the `acl` param to be null, since certain storage system throw an error if an unsupported header value is provided.

## 1.6.0 (12. April 2023)

+ **Removed Testing for PHP 7.0, 7.1, 7.2 and 7.3**
Expand Down
11 changes: 7 additions & 4 deletions src/S3FileSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class S3FileSystem extends BaseFileSystemStorage
public $region;

/**
* @var string The ACL default permission when writing new files. All available options are `private|public-read|public-read-write|authenticated-read|aws-exec-read|bucket-owner-read|bucket-owner-full-control`
* @var string The ACL default permission when writing new files. All available options are `private|public-read|public-read-write|authenticated-read|aws-exec-read|bucket-owner-read|bucket-owner-full-control` if null, this header
* will be ignored.
*/
public $acl = 'public-read';

Expand Down Expand Up @@ -132,7 +133,9 @@ public function extendPutObject(array $config)
$config['CacheControl'] = 'max-age=' . $this->maxAge;
}

return $config;
// remove null values from the config,
// this is mainly usfull if acl is set to null.
return array_filter($config);
}

private $_client;
Expand Down Expand Up @@ -245,12 +248,12 @@ public function updateBucketPolicy($policy)
*/
public function folderCreate($folder)
{
return $this->client->putObject([
return $this->client->putObject(array_filter([
'ACL' => $this->acl,
'Bucket' => $this->bucket,
'Key' => rtrim($folder, '/') . '/',
'Body' => "",
]);
]));
}

/**
Expand Down

0 comments on commit 4d23c0d

Please sign in to comment.