Fixed media deletion (#8240)

Fixes #8239
This commit is contained in:
GiuseppeMusso-Laser 2019-07-18 21:22:31 +02:00 committed by Sébastien Ros
parent a5b2c3d53f
commit 8ca5351872

View File

@ -94,7 +94,8 @@ namespace Orchard.MediaLibrary.Services {
if (!String.IsNullOrEmpty(folderPath)) {
if (recursive) {
query = query.Join<MediaPartRecord>().Where(m => m.FolderPath.StartsWith(folderPath));
var subfolderSearch = folderPath.EndsWith(Path.DirectorySeparatorChar.ToString()) ? folderPath : folderPath + Path.DirectorySeparatorChar;
query = query.Join<MediaPartRecord>().Where(m => (m.FolderPath == folderPath || m.FolderPath.StartsWith(subfolderSearch)));
}
else {
query = query.Join<MediaPartRecord>().Where(m => m.FolderPath == folderPath);