Create target folder if not exist when moving media

Fixes #6856
This commit is contained in:
Sergio Navarro
2016-05-05 21:59:01 +02:00
committed by Sébastien Ros
parent 91488f31da
commit 018a3faa2e

View File

@@ -379,6 +379,8 @@ namespace Orchard.MediaLibrary.Services {
Argument.ThrowIfNullOrEmpty(filename, "filename");
Argument.ThrowIfNullOrEmpty(newFilename, "newFilename");
if (!_storageProvider.FolderExists(newPath))
_storageProvider.TryCreateFolder(newPath);
_storageProvider.RenameFile(_storageProvider.Combine(currentPath, filename), _storageProvider.Combine(newPath, newFilename));
}