From d077fd2ab1f4f2defdce490f7395c22f3b3fb5a7 Mon Sep 17 00:00:00 2001 From: Luke Kuzmish Date: Sat, 25 Oct 2025 07:11:26 -0400 Subject: [PATCH 1/2] default to unix slash --- src/Illuminate/Filesystem/AwsS3V3Adapter.php | 6 ++---- tests/Filesystem/FilesystemAdapterTest.php | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/Filesystem/AwsS3V3Adapter.php b/src/Illuminate/Filesystem/AwsS3V3Adapter.php index 685e396f836d..2960d693fce7 100644 --- a/src/Illuminate/Filesystem/AwsS3V3Adapter.php +++ b/src/Illuminate/Filesystem/AwsS3V3Adapter.php @@ -29,13 +29,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'] ?? '', '/'); } /** diff --git a/tests/Filesystem/FilesystemAdapterTest.php b/tests/Filesystem/FilesystemAdapterTest.php index 11641e9a7509..284cc7fdbcbf 100644 --- a/tests/Filesystem/FilesystemAdapterTest.php +++ b/tests/Filesystem/FilesystemAdapterTest.php @@ -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); + } } From 2d68c95befd3bc4648c54b1a1fa2653942847552 Mon Sep 17 00:00:00 2001 From: Luke Kuzmish Date: Sat, 25 Oct 2025 07:19:17 -0400 Subject: [PATCH 2/2] style --- src/Illuminate/Filesystem/AwsS3V3Adapter.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Illuminate/Filesystem/AwsS3V3Adapter.php b/src/Illuminate/Filesystem/AwsS3V3Adapter.php index 2960d693fce7..99aad445f45d 100644 --- a/src/Illuminate/Filesystem/AwsS3V3Adapter.php +++ b/src/Illuminate/Filesystem/AwsS3V3Adapter.php @@ -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 {