mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-08 00:14:31 +08:00
Fixes #6323
This commit is contained in:

committed by
Sébastien Ros

parent
99e76e8af7
commit
6e95dc9d92
@@ -239,7 +239,8 @@ namespace Orchard.Azure.Services.FileSystems {
|
||||
}
|
||||
|
||||
if (blob is CloudBlobDirectory) {
|
||||
string foldername = blob.Uri.Segments.Last();
|
||||
var blobDir = (CloudBlobDirectory)blob;
|
||||
string foldername = blobDir.Prefix.Substring(blobDir.Parent.Prefix.Length);
|
||||
string source = String.Concat(path, foldername);
|
||||
string destination = String.Concat(newPath, foldername);
|
||||
RenameFolder(source, destination);
|
||||
|
@@ -328,15 +328,16 @@ namespace Orchard.MediaLibrary.Services {
|
||||
Argument.ThrowIfNullOrEmpty(newFolderName, "newFolderName");
|
||||
|
||||
try {
|
||||
var segments = folderPath.Split(new char[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries).ToArray();
|
||||
var newFolderPath = String.Join(Path.DirectorySeparatorChar.ToString(), segments.Take(segments.Length - 1).Union(new[] { newFolderName }));
|
||||
var parentIndex = folderPath.LastIndexOfAny(new char[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar });
|
||||
var parentPath = parentIndex > 0 ? folderPath.Substring(0, parentIndex) : String.Empty;
|
||||
var newFolderPath = _storageProvider.Combine(parentPath, newFolderName);
|
||||
|
||||
var mediaParts = BuildGetMediaContentItemsQuery(_orchardServices.ContentManager, folderPath, true).List();
|
||||
foreach (var mediaPart in mediaParts) {
|
||||
mediaPart.FolderPath = newFolderPath + mediaPart.FolderPath.Substring(folderPath.Length);
|
||||
}
|
||||
|
||||
_storageProvider.RenameFolder(folderPath, _storageProvider.Combine(Path.GetDirectoryName(folderPath), newFolderName));
|
||||
_storageProvider.RenameFolder(folderPath, newFolderPath);
|
||||
}
|
||||
catch (Exception) {
|
||||
_orchardServices.TransactionManager.Cancel();
|
||||
|
Reference in New Issue
Block a user