From 6283025398fa0e26f692af8a674a57ff8dcb4ae3 Mon Sep 17 00:00:00 2001 From: adam goucher Date: Tue, 21 Nov 2023 12:44:23 -0500 Subject: [PATCH 1/3] check if local path is valid before writing fixes https://github.com/SpartnerNL/Laravel-Excel/issues/4033 --- src/Writer.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Writer.php b/src/Writer.php index 37bc4850..6b333b8a 100644 --- a/src/Writer.php +++ b/src/Writer.php @@ -165,6 +165,11 @@ public function write($export, TemporaryFile $temporaryFile, string $writerType) $export ); + if ($temporaryFile instanceof RemoteTemporaryFile && !$temporaryFile->existsLocally()) { + $temporaryFile = resolve(TemporaryFileFactory::class) + ->makeLocal(Arr::last(explode('/', $temporaryFile->getLocalPath()))); + } + $writer->save( $temporaryFile->getLocalPath() ); From e00ee82bb238e3e883748dd1e9d8a7fec0b3d537 Mon Sep 17 00:00:00 2001 From: adam goucher Date: Fri, 24 Nov 2023 08:40:01 -0500 Subject: [PATCH 2/3] missing import --- src/Writer.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Writer.php b/src/Writer.php index 6b333b8a..f4c3395b 100644 --- a/src/Writer.php +++ b/src/Writer.php @@ -2,6 +2,7 @@ namespace Maatwebsite\Excel; +use Illuminate\Support\Arr; use Maatwebsite\Excel\Concerns\WithBackgroundColor; use Maatwebsite\Excel\Concerns\WithCustomValueBinder; use Maatwebsite\Excel\Concerns\WithDefaultStyles; From 31859b3d4e606ae9ac2cab96d6b2965e2820dd2a Mon Sep 17 00:00:00 2001 From: adam goucher Date: Sat, 25 Nov 2023 11:56:45 -0500 Subject: [PATCH 3/3] fixing extra spaces on empty line --- src/Writer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Writer.php b/src/Writer.php index f4c3395b..178268b1 100644 --- a/src/Writer.php +++ b/src/Writer.php @@ -170,7 +170,7 @@ public function write($export, TemporaryFile $temporaryFile, string $writerType) $temporaryFile = resolve(TemporaryFileFactory::class) ->makeLocal(Arr::last(explode('/', $temporaryFile->getLocalPath()))); } - + $writer->save( $temporaryFile->getLocalPath() );