From 99760ad7865a418708474cf594e736a381b45c0e Mon Sep 17 00:00:00 2001 From: Alain Martini Date: Mon, 27 May 2024 11:07:25 +0200 Subject: [PATCH] Unwanted deletion fixes (#3619) * 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 --- src/MediaCollections/Filesystem.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MediaCollections/Filesystem.php b/src/MediaCollections/Filesystem.php index c2cc1ec61..9e8b908ac 100644 --- a/src/MediaCollections/Filesystem.php +++ b/src/MediaCollections/Filesystem.php @@ -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);