From 914d490f20332a677f73bbb1b8c8800eda4e4ba7 Mon Sep 17 00:00:00 2001 From: Patrick O'Meara Date: Sat, 27 Jul 2024 19:37:59 +1000 Subject: [PATCH] Skip path logic when not needed This makes things a bit quicker when dealing with lots of files --- src/Conversions/FileManipulator.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Conversions/FileManipulator.php b/src/Conversions/FileManipulator.php index 9a068085d..79e96f13f 100644 --- a/src/Conversions/FileManipulator.php +++ b/src/Conversions/FileManipulator.php @@ -59,13 +59,17 @@ public function performConversions( $conversions ->reject(function (Conversion $conversion) use ($onlyMissing, $media) { + if (! $onlyMissing) { + return false; + } + $relativePath = $media->getPath($conversion->getName()); if ($rootPath = config("filesystems.disks.{$media->disk}.root")) { $relativePath = str_replace($rootPath, '', $relativePath); } - return $onlyMissing && Storage::disk($media->disk)->exists($relativePath); + return Storage::disk($media->disk)->exists($relativePath); }) ->each(function (Conversion $conversion) use ($media, $copiedOriginalFile) { (new PerformConversionAction)->execute($conversion, $media, $copiedOriginalFile);