Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Filesystem/Flysystem/AdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ private static function createS3Adapter(array $parsed): FilesystemAdapter // @ph
return new AsyncAwsS3Adapter(
new AsyncS3Client([
'region' => $parsed['query']['region'] ?? $parsed['fragment'] ?? throw new \InvalidArgumentException('A region must be set in the query (ie ?region=us-east-1) or as the fragment (ie #us-east-1).'),
'accessKeyId' => $parsed['user'] ?? null,
'accessKeySecret' => $parsed['pass'] ?? null,
...($parsed['user'] ?? null) !== null ? ['accessKeyId' => $parsed['user']] : [],
...($parsed['pass'] ?? null) !== null ? ['accessKeySecret' => $parsed['pass']] : [],
]),
$parsed['host'] ?? throw new \InvalidArgumentException('A bucket must be set as the host.'), // bucket
$parsed['path'] ?? '', // prefix
Expand All @@ -184,10 +184,10 @@ private static function createS3Adapter(array $parsed): FilesystemAdapter // @ph
return new AwsS3V3Adapter( // @phpstan-ignore return.type
new S3Client([ // @phpstan-ignore class.notFound
'region' => $parsed['query']['region'] ?? $parsed['fragment'] ?? throw new \InvalidArgumentException('A region must be set in the query (ie ?region=us-east-1) or as the fragment (ie #us-east-1).'),
'credentials' => [
...($parsed['user'] ?? null) !== null ? ['credentials' => [
'key' => $parsed['user'] ?? null,
'secret' => $parsed['pass'] ?? null,
],
]] : [],
'version' => $parsed['query']['version'] ?? 'latest',
]),
$parsed['host'] ?? throw new \InvalidArgumentException('A bucket must be set as the host.'), // bucket
Expand Down