From 23e2998f947c9cc36b1aa7b7711cb1f8d09d96bc Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 5 Dec 2022 01:52:24 -0700 Subject: [PATCH] Update DeleteAccountPipeline, handle flysystem v3 changes by checking files exist before attempting to delete --- .../DeletePipeline/DeleteAccountPipeline.php | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/app/Jobs/DeletePipeline/DeleteAccountPipeline.php b/app/Jobs/DeletePipeline/DeleteAccountPipeline.php index 4ca5195c6..3e6c974f4 100644 --- a/app/Jobs/DeletePipeline/DeleteAccountPipeline.php +++ b/app/Jobs/DeletePipeline/DeleteAccountPipeline.php @@ -88,10 +88,14 @@ class DeleteAccountPipeline implements ShouldQueue ])) { if(config('pixelfed.cloud_storage')) { $disk = Storage::disk(config('filesystems.cloud')); - $disk->delete($path); + if($disk->exists($path)) { + $disk->delete($path); + } } $disk = Storage::disk(config('filesystems.local')); - $disk->delete($path); + if($disk->exists($path)) { + $disk->delete($path); + } } $avatar->forceDelete(); @@ -152,12 +156,20 @@ class DeleteAccountPipeline implements ShouldQueue foreach($medias as $media) { if(config('pixelfed.cloud_storage')) { $disk = Storage::disk(config('filesystems.cloud')); - $disk->delete($media->media_path); - $disk->delete($media->thumbnail_path); + if($disk->exists($media->media_path)) { + $disk->delete($media->media_path); + } + if($disk->exists($media->thumbnail_path)) { + $disk->delete($media->thumbnail_path); + } } $disk = Storage::disk(config('filesystems.local')); - $disk->delete($media->media_path); - $disk->delete($media->thumbnail_path); + if($disk->exists($media->media_path)) { + $disk->delete($media->media_path); + } + if($disk->exists($media->thumbnail_path)) { + $disk->delete($media->thumbnail_path); + } $media->forceDelete(); } });