Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] deleting folder causes other folders that start the same to be deleted too #715

Open
becquerel opened this issue Jul 16, 2019 · 0 comments

Comments

@becquerel
Copy link
Contributor

Summary of issue

When deleting the folder, other folders on the same level (not inside) get deleted as well

Steps to reproduce

create two directories: slider and slider-homepage. Delete only the slider directory - slider-homepage will get deleted as well

System Details

v3.6.1

Problem is in Modules/Media/Repositories/Eloquent/EloquentFolderRepository.php, line 85
return $this->model->where('path', 'like', "{$path}%")->get();
it tries to find all folders that start with the same string as the deleted folder. Perhaps missing forward slash would do the trick ? (seems it does for me)
return $this->model->where('path', 'like', "{$path}/%")->get();

becquerel added a commit to becquerel/Platform that referenced this issue Jul 16, 2019
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.
nWidart added a commit that referenced this issue Jul 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant