mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 10:54:50 +08:00
Fixing folder creation on Azure
--HG-- branch : 1.x
This commit is contained in:
@@ -165,6 +165,21 @@ namespace Orchard.Azure.Tests.FileSystems.Media {
|
|||||||
Assert.AreEqual(1, _azureBlobStorageProvider.ListFiles("folder1/folder4/folder3").Count());
|
Assert.AreEqual(1, _azureBlobStorageProvider.ListFiles("folder1/folder4/folder3").Count());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[ExpectedException(typeof(ArgumentException))]
|
||||||
|
public void CannotCreateAlreadyExistingFolders()
|
||||||
|
{
|
||||||
|
_azureBlobStorageProvider.CreateFile("folder1/foo.txt");
|
||||||
|
_azureBlobStorageProvider.CreateFolder("folder1");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void CanCreateAlreadyExistingFolder()
|
||||||
|
{
|
||||||
|
_azureBlobStorageProvider.CreateFile("folder1/foo.txt");
|
||||||
|
_azureBlobStorageProvider.TryCreateFolder("folder1");
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void ShouldReadWriteFiles() {
|
public void ShouldReadWriteFiles() {
|
||||||
const string teststring = "This is a test string.";
|
const string teststring = "This is a test string.";
|
||||||
|
@@ -156,8 +156,14 @@ namespace Orchard.Azure {
|
|||||||
|
|
||||||
public void TryCreateFolder(string path) {
|
public void TryCreateFolder(string path) {
|
||||||
EnsurePathIsRelative(path);
|
EnsurePathIsRelative(path);
|
||||||
|
using (new HttpContextWeaver()) {
|
||||||
|
if (Container.DirectoryExists(String.Concat(_root, path))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CreateFile(Combine(path, FolderEntry));
|
CreateFile(Combine(path, FolderEntry));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void CreateFolder(string path) {
|
public void CreateFolder(string path) {
|
||||||
EnsurePathIsRelative(path);
|
EnsurePathIsRelative(path);
|
||||||
|
Reference in New Issue
Block a user