Skip to content

Commit

Permalink
Unwanted deletion fixes (#3619)
Browse files Browse the repository at this point in the history
* fixes too loose condition that cause to wipe out all generated responsive images if they are in the same output directory

* more elegant and inclusive fix to avoid wrong deletions
  • Loading branch information
inalto authored May 27, 2024
1 parent 8479335 commit 99760ad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/MediaCollections/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public function removeResponsiveImages(Media $media, string $conversionName = 'm

$responsiveImagePaths = array_filter(
$allFilePaths,
fn (string $path) => Str::contains($path, $media->name) && Str::contains($path, $conversionName)
fn (string $path) => Str::contains($path, $media->name."___". $conversionName)
);

$this->filesystem->disk($media->disk)->delete($responsiveImagePaths);
Expand Down

0 comments on commit 99760ad

Please sign in to comment.