From a7299612d7d8289c08a730053e8d2999ad49cc47 Mon Sep 17 00:00:00 2001 From: David Cap Date: Tue, 16 Jul 2019 08:03:45 -0700 Subject: [PATCH] fix folder deletion bug (#715) prevent deletion of folders that are NOT actually subfolders and only start with the same sequence of characters. Originally, if I have two or more folders on the same level: `slider` `slider-homepage` and I delete only the `slider` one, `slider-homepage` would get deleted as well. This change makes sure the deleted folders are actually subfolders of the deleted one. --- .../Media/Repositories/Eloquent/EloquentFolderRepository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Media/Repositories/Eloquent/EloquentFolderRepository.php b/Modules/Media/Repositories/Eloquent/EloquentFolderRepository.php index b277c5d78..6ae1f17c2 100644 --- a/Modules/Media/Repositories/Eloquent/EloquentFolderRepository.php +++ b/Modules/Media/Repositories/Eloquent/EloquentFolderRepository.php @@ -82,7 +82,7 @@ public function allChildrenOf(File $folder) { $path = $folder->path->getRelativeUrl(); - return $this->model->where('path', 'like', "{$path}%")->get(); + return $this->model->where('path', 'like', "{$path}/%")->get(); } public function allNested(): NestedFoldersCollection