From 4f9982315468339e08244a033ff0033345524183 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 5 Sep 2022 11:45:00 +0200 Subject: [PATCH 1/4] Fix AwsS3V3Adapter::providesTemporaryUrls() --- src/Illuminate/Filesystem/AwsS3V3Adapter.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Illuminate/Filesystem/AwsS3V3Adapter.php b/src/Illuminate/Filesystem/AwsS3V3Adapter.php index 8c0d9df1b0bb..e57dcedab6df 100644 --- a/src/Illuminate/Filesystem/AwsS3V3Adapter.php +++ b/src/Illuminate/Filesystem/AwsS3V3Adapter.php @@ -55,6 +55,18 @@ public function url($path) $this->config['bucket'], $this->prefixer->prefixPath($path) ); } + + /** + * Determine if temporary URLs can be generated. + * + * @return bool + */ + public function providesTemporaryUrls() + { + // S3Adapter doesn't provide a getTemporaryUrl method, but this AwsS3V3Adapter provides temporary urls. + + return true; + } /** * Get a temporary URL for the file at the given path. From f9321f249b40e8cd8eaa5d87edfdb0d9fefdcbf8 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 5 Sep 2022 12:22:56 +0200 Subject: [PATCH 2/4] Fix style issue --- src/Illuminate/Filesystem/AwsS3V3Adapter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Filesystem/AwsS3V3Adapter.php b/src/Illuminate/Filesystem/AwsS3V3Adapter.php index e57dcedab6df..14e3221d649b 100644 --- a/src/Illuminate/Filesystem/AwsS3V3Adapter.php +++ b/src/Illuminate/Filesystem/AwsS3V3Adapter.php @@ -55,7 +55,7 @@ public function url($path) $this->config['bucket'], $this->prefixer->prefixPath($path) ); } - + /** * Determine if temporary URLs can be generated. * From 2a537e7f7c204072fa8efa9aa3caa6f41aae058d Mon Sep 17 00:00:00 2001 From: Michael Hurni Date: Mon, 5 Sep 2022 14:26:34 +0200 Subject: [PATCH 3/4] Add unit test --- tests/Filesystem/FilesystemAdapterTest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/Filesystem/FilesystemAdapterTest.php b/tests/Filesystem/FilesystemAdapterTest.php index b50f68cf4129..8fe056078ab5 100644 --- a/tests/Filesystem/FilesystemAdapterTest.php +++ b/tests/Filesystem/FilesystemAdapterTest.php @@ -547,6 +547,17 @@ public function testProvidesTemporaryUrlsWithCustomCallback() $this->assertTrue($filesystemAdapter->providesTemporaryUrls()); } + public function testProvidesTemporaryUrlsForS3Adapter() + { + $filesystem = new FilesystemManager(new Application); + $filesystemAdapter = $filesystem->createS3Driver([ + 'region' => 'us-west-1', + 'bucket' => 'laravel', + ]); + + $this->assertTrue($filesystemAdapter->providesTemporaryUrls()); + } + public function testProvidesTemporaryUrlsForAdapterWithoutTemporaryUrlSupport() { $filesystemAdapter = new FilesystemAdapter($this->filesystem, $this->adapter); From 1666702b4c181ecb5b861a78263b98e9466ad343 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 5 Sep 2022 09:29:02 -0500 Subject: [PATCH 4/4] Update AwsS3V3Adapter.php --- src/Illuminate/Filesystem/AwsS3V3Adapter.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Illuminate/Filesystem/AwsS3V3Adapter.php b/src/Illuminate/Filesystem/AwsS3V3Adapter.php index 14e3221d649b..9c210c8fbc15 100644 --- a/src/Illuminate/Filesystem/AwsS3V3Adapter.php +++ b/src/Illuminate/Filesystem/AwsS3V3Adapter.php @@ -63,8 +63,6 @@ public function url($path) */ public function providesTemporaryUrls() { - // S3Adapter doesn't provide a getTemporaryUrl method, but this AwsS3V3Adapter provides temporary urls. - return true; }