Skip to content

Commit

Permalink
Skip path logic when not needed
Browse files Browse the repository at this point in the history
This makes things a bit quicker when dealing with lots of files
  • Loading branch information
patrickomeara committed Jul 27, 2024
1 parent 65e10ad commit 914d490
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Conversions/FileManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 914d490

Please sign in to comment.