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
5 changes: 5 additions & 0 deletions src/Illuminate/Filesystem/AwsS3V3Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
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 @@ -31,6 +32,10 @@ public function __construct(FilesystemOperator $driver, FlysystemAdapter $adapte
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 @@ -715,6 +715,21 @@ public function testProvidesTemporaryUrlsForS3Adapter()
$this->assertTrue($filesystemAdapter->providesTemporaryUrls());
}

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

$path = $filesystemAdapter->path('different');
$this->assertStringContainsString('/', $path);
$this->assertStringNotContainsString('\\', $path);
}

public function testProvidesTemporaryUrlsForAdapterWithoutTemporaryUrlSupport()
{
$filesystemAdapter = new FilesystemAdapter($this->filesystem, $this->adapter);
Expand Down
Loading