diff --git a/README.md b/README.md index b6ca101..42c148e 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ $schemes = [ // Optional configuration settings. // 'options' => [ - // 'ACL' => 'public-read', + // 'ACL' => 'public-read', // If bucket is private, set to 'private' // 'StorageClass' => 'REDUCED_REDUNDANCY', // ], @@ -59,9 +59,11 @@ $schemes = [ // 'endpoint' => 'https://api.example.com', // An alternative API endpoint // for 3rd party S3 providers. - // 'expires' => '+600 seconds', // If a file is private, the - // expiry time of a presigned - // URL. + // 'expires' => '+600 seconds', // An optional expiry time + // to use when generating + // presigend URLs for private + // files. Default is +3600 + // seconds (one hour). ], 'cache' => TRUE, // Creates a metadata cache to speed up lookups. diff --git a/src/Flysystem/S3.php b/src/Flysystem/S3.php index 13d7ce8..3a530b2 100644 --- a/src/Flysystem/S3.php +++ b/src/Flysystem/S3.php @@ -114,7 +114,7 @@ class S3 implements FlysystemPluginInterface, ContainerFactoryPluginInterface { $this->bucket = $config->get('bucket', ''); $this->prefix = $config->get('prefix', ''); $this->options = $config->get('options', []); - $this->expires = $config->get('expires'); + $this->expires = $config->get('expires', '+3600 seconds'); $this->urlPrefix = $this->calculateUrlPrefix($config); @@ -216,7 +216,7 @@ class S3 implements FlysystemPluginInterface, ContainerFactoryPluginInterface { // we log it and return an unsigned URL so we don't break the expected // return or completely break the response. try { - if ($this->options['ACL'] != 'public-read' && $this->getAdapter()->getVisibility($target)['visibility'] == AdapterInterface::VISIBILITY_PRIVATE && $this->expires) { + if ($this->options['ACL'] != 'public-read' && $this->getAdapter()->getVisibility($target)['visibility'] == AdapterInterface::VISIBILITY_PRIVATE) { // Use getCommand() so we don't actually make a request yet. $command = $this->client->getCommand('getObject', [ 'Bucket' => $this->bucket,