mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Fixing folder splitting display in media
--HG-- branch : dev
This commit is contained in:
@@ -44,6 +44,18 @@ namespace Orchard.Azure.Tests.FileSystems.Media {
|
||||
_azureBlobStorageProvider.DeleteFile("notexisting");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RootFolderAreNotCropped() {
|
||||
_azureBlobStorageProvider.CreateFolder("default");
|
||||
_azureBlobStorageProvider.CreateFolder("foo");
|
||||
|
||||
var folders = _azureBlobStorageProvider.ListFolders("");
|
||||
|
||||
Assert.That(folders.Count(), Is.EqualTo(2));
|
||||
Assert.That(folders.Any(f => f.GetName() == "default"), Is.True);
|
||||
Assert.That(folders.Any(f => f.GetName() == "foo"), Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreateFileShouldReturnCorrectStorageFile() {
|
||||
var storageFile = _azureBlobStorageProvider.CreateFile("foo.txt");
|
||||
|
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Orchard.Media.Models;
|
||||
|
||||
namespace Orchard.Media.Helpers {
|
||||
@@ -9,12 +10,12 @@ namespace Orchard.Media.Helpers {
|
||||
if (String.IsNullOrEmpty(mediaPath)) {
|
||||
return navigations;
|
||||
}
|
||||
if (!mediaPath.Contains("\\")) {
|
||||
if ( !mediaPath.Contains(Path.DirectorySeparatorChar.ToString()) && !mediaPath.Contains(Path.AltDirectorySeparatorChar.ToString()) ) {
|
||||
navigations.Add(new FolderNavigation { FolderName = mediaPath, FolderPath = mediaPath });
|
||||
return navigations;
|
||||
}
|
||||
|
||||
string[] navigationParts = mediaPath.Split(new[] { "\\" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] navigationParts = mediaPath.Split(new[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar}, StringSplitOptions.RemoveEmptyEntries);
|
||||
string currentPath = String.Empty;
|
||||
foreach (string navigationPart in navigationParts) {
|
||||
currentPath = (string.IsNullOrEmpty(currentPath) ? navigationPart : currentPath + "\\" + navigationPart);
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<p>@Html.ActionLink(T("Media Folders").ToString(), "Index") >
|
||||
@foreach (FolderNavigation navigation in MediaHelpers.GetFolderNavigationHierarchy(Model.MediaPath)) {
|
||||
@Html.ActionLink(navigation.FolderName, "Edit",
|
||||
new {name = navigation.FolderName, mediaPath = navigation.FolderPath})
|
||||
new {name = navigation.FolderName, mediaPath = navigation.FolderPath}) <text>></text>
|
||||
|
||||
}
|
||||
@T("Folder Properties")</p>
|
||||
|
Reference in New Issue
Block a user