From a84c75b4c5e04c0081a953625b2ca2b46063b70b Mon Sep 17 00:00:00 2001 From: Roj Vroemen Date: Thu, 15 Oct 2026 11:41:53 +0200 Subject: [PATCH 1/2] test: read images uploaded to a cloud temporary disk The uploader reads a resizable image from the Curator disk using the temporary file's prefixed path, so a cloud temporary disk with a root (or a different disk from Curator's) can't be read. This test fails until that's fixed. Co-Authored-By: Claude Opus 5.5 --- .../Components/CloudTemporaryUploadTest.php | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tests/src/Feature/Components/CloudTemporaryUploadTest.php diff --git a/tests/src/Feature/Components/CloudTemporaryUploadTest.php b/tests/src/Feature/Components/CloudTemporaryUploadTest.php new file mode 100644 index 0000000..6bda206 --- /dev/null +++ b/tests/src/Feature/Components/CloudTemporaryUploadTest.php @@ -0,0 +1,39 @@ + 'public', + 'filesystems.disks.s3' => [ + 'driver' => 's3', + 'root' => 'public', + ], + 'livewire.temporary_file_upload.disk' => 's3', + ]); + + Storage::fake('public'); +}); + +test('an image uploaded to a cloud temporary disk is read from that disk', function () { + expect(Curator::isUsingCloudDisk())->toBeTrue(); + + Livewire::test(CreateMedia::class) + ->set('data.file', UploadedFile::fake()->image('photo.png', 40, 20)) + ->call('create') + ->assertHasNoFormErrors(); + + $media = Media::query()->sole(); + + expect($media->width)->toBe(40) + ->and($media->height)->toBe(20); + + Storage::disk('public')->assertExists($media->path); +}); From ea4b5f136e237d61a62bb9602f176bcf84e11eb9 Mon Sep 17 00:00:00 2001 From: Roj Vroemen Date: Thu, 15 Oct 2026 11:43:31 +0200 Subject: [PATCH 2/2] fix: read cloud temporary uploads from their own disk Port of #563. The uploader read resizable images with Storage::disk($curatorDisk)->get($file->path()), but path() already carries the temporary disk's root, so a root of `public` became `public/public/livewire-tmp/...`, and it read from Curator's disk rather than the temporary one. TemporaryUploadedFile::get() reads the file from its own disk with the unprefixed path. Co-Authored-By: Claude Opus 5.5 --- src/Components/Forms/Uploader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/Forms/Uploader.php b/src/Components/Forms/Uploader.php index 12f9b00..17e2998 100644 --- a/src/Components/Forms/Uploader.php +++ b/src/Components/Forms/Uploader.php @@ -67,7 +67,7 @@ protected function setUp(): void if (Curator::isResizable($extension)) { if (Curator::isUsingCloudDisk()) { - $content = Storage::disk($component->getDiskName())->get($file->path()); + $content = $file->get(); } else { $content = $file->getRealPath(); }