File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ class UnduplicateCommand extends Command
9696 private $ metadataHandler ;
9797
9898 public function __construct (
99- private readonly ConnectionPool $ connectionPool ,
99+ private readonly ConnectionPool $ connectionPool ,
100100 private readonly StorageRepository $ storageRepository
101101 )
102102 {
@@ -609,10 +609,17 @@ private function findAndDeleteOldProcessedFile(int $oldFileUid): void
609609
610610 private function deleteProcessedFile (mixed $ identifier , int $ storageId ): void
611611 {
612+ if (empty ($ identifier ) || empty ($ storageId )) {
613+ $ this ->output ->writeln ('<error>Empty identifier or storage id. Aborting delete of processed file</error> ' );
614+ return ;
615+ }
616+
612617 $ storage = $ this ->storageRepository ->getStorageObject ($ storageId );
613618 $ storagePath = Environment::getPublicPath () . DIRECTORY_SEPARATOR . $ storage ->getRootLevelFolder ()->getPublicUrl ();
614619 $ file = rtrim ($ storagePath , '/ ' ) . $ identifier ;
620+
615621 $ this ->output ->writeln ('<info>Deleting processed file ' . $ file . '</info> ' );
622+
616623 if (file_exists ($ file )) {
617624 unlink ($ file );
618625 // delete all empty parent folders
You can’t perform that action at this time.
0 commit comments