mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +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) {
|
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 source = String.Concat(path, foldername);
|
||||||
string destination = String.Concat(newPath, foldername);
|
string destination = String.Concat(newPath, foldername);
|
||||||
RenameFolder(source, destination);
|
RenameFolder(source, destination);
|
||||||
|
|||||||
@@ -328,15 +328,16 @@ namespace Orchard.MediaLibrary.Services {
|
|||||||
Argument.ThrowIfNullOrEmpty(newFolderName, "newFolderName");
|
Argument.ThrowIfNullOrEmpty(newFolderName, "newFolderName");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var segments = folderPath.Split(new char[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries).ToArray();
|
var parentIndex = folderPath.LastIndexOfAny(new char[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar });
|
||||||
var newFolderPath = String.Join(Path.DirectorySeparatorChar.ToString(), segments.Take(segments.Length - 1).Union(new[] { newFolderName }));
|
var parentPath = parentIndex > 0 ? folderPath.Substring(0, parentIndex) : String.Empty;
|
||||||
|
var newFolderPath = _storageProvider.Combine(parentPath, newFolderName);
|
||||||
|
|
||||||
var mediaParts = BuildGetMediaContentItemsQuery(_orchardServices.ContentManager, folderPath, true).List();
|
var mediaParts = BuildGetMediaContentItemsQuery(_orchardServices.ContentManager, folderPath, true).List();
|
||||||
foreach (var mediaPart in mediaParts) {
|
foreach (var mediaPart in mediaParts) {
|
||||||
mediaPart.FolderPath = newFolderPath + mediaPart.FolderPath.Substring(folderPath.Length);
|
mediaPart.FolderPath = newFolderPath + mediaPart.FolderPath.Substring(folderPath.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
_storageProvider.RenameFolder(folderPath, _storageProvider.Combine(Path.GetDirectoryName(folderPath), newFolderName));
|
_storageProvider.RenameFolder(folderPath, newFolderPath);
|
||||||
}
|
}
|
||||||
catch (Exception) {
|
catch (Exception) {
|
||||||
_orchardServices.TransactionManager.Cancel();
|
_orchardServices.TransactionManager.Cancel();
|
||||||
|
|||||||
Reference in New Issue
Block a user