Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 2 additions & 5 deletions src/Illuminate/Filesystem/AwsS3V3Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Illuminate\Support\Traits\Conditionable;
use League\Flysystem\FilesystemAdapter as FlysystemAdapter;
use League\Flysystem\FilesystemOperator;
use League\Flysystem\PathPrefixer;

class AwsS3V3Adapter extends FilesystemAdapter
{
Expand All @@ -29,13 +28,11 @@ class AwsS3V3Adapter extends FilesystemAdapter
*/
public function __construct(FilesystemOperator $driver, FlysystemAdapter $adapter, array $config, S3Client $client)
{
$config['directory_separator'] = '/';

parent::__construct($driver, $adapter, $config);

$this->client = $client;

$this->prefixer = isset($config['prefix'])
? new PathPrefixer($this->prefixer->prefixPath($config['prefix']), '/')
: new PathPrefixer($config['root'] ?? '', '/');
}

/**
Expand Down
15 changes: 15 additions & 0 deletions tests/Filesystem/FilesystemAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -752,4 +752,19 @@ public function testGetChecksum()
$this->assertEquals('730bed78bccf58c2cfe44c29b71e5e6b', $filesystemAdapter->checksum('path.txt'));
$this->assertEquals('a5c3556d', $filesystemAdapter->checksum('path.txt', ['checksum_algo' => 'crc32']));
}

public function testUsesRightSeperatorForS3AdapterWithoutDoublePrefixing()
{
$filesystem = new FilesystemManager(new Application);
$filesystemAdapter = $filesystem->createS3Driver([
'region' => 'us-west-1',
'bucket' => 'laravel',
'root' => 'my-root',
'prefix' => 'someprefix',
'directory_separator' => '\\',
]);

$path = $filesystemAdapter->path('different');
$this->assertEquals('my-root/someprefix/different', $path);
}
}
Loading