File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
UmbracoFileSystemProviders.Azure.Tests
UmbracoFileSystemProviders.Azure Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -639,13 +639,17 @@ public void TestGetSubDirectoriesNone()
639
639
// Arrange
640
640
AzureBlobFileSystem provider = this . CreateAzureBlobFileSystem ( containerName : "forms-data" ) ;
641
641
provider . AddFile ( "forms/b5e2fab3-040d-4328-ac74-cf7f7ebe3918.json" , Stream . Null ) ;
642
+ provider . AddFile ( "workflows/b5e2fab3-040d-4328-ac74-cf7f7ebe3918.json" , Stream . Null ) ;
642
643
643
644
// Act
644
645
IEnumerable < string > actual = provider . GetDirectories ( "forms" ) ;
645
646
646
647
// Assert
647
648
string [ ] expected = { } ;
648
649
Assert . IsTrue ( expected . SequenceEqual ( actual ) ) ;
650
+
651
+ // Tidy up after test
652
+ provider . DeleteDirectory ( "forms" ) ;
649
653
}
650
654
}
651
655
}
Original file line number Diff line number Diff line change @@ -518,12 +518,13 @@ public IEnumerable<string> GetDirectories(string path)
518
518
var directory = this . GetDirectoryReference ( path ) ;
519
519
520
520
var listedBlobs = directory . ListBlobs ( ) ;
521
- var prefixes = listedBlobs . Where ( blob => blob . IsPrefix ) . Select ( x=> x . Prefix ) . ToList ( ) ;
522
- var blobPrefixes = listedBlobs . Where ( x => x . IsBlob && x . Blob . Name . LastIndexOf ( '/' ) >= 0 ) . Select ( x => x . Blob . Name . Substring ( 0 , x . Blob . Name . LastIndexOf ( '/' ) + 1 ) ) ;
523
-
524
-
521
+ var prefixes = listedBlobs . Where ( blob => blob . IsPrefix ) . Select ( x => x . Prefix ) . ToList ( ) ;
522
+ var blobPrefixes = listedBlobs . Where ( x => x . IsBlob && x . Blob . Name . LastIndexOf ( '/' ) >= 0 )
523
+ . Select ( x => x . Blob . Name . Substring ( 0 , x . Blob . Name . LastIndexOf ( '/' ) + 1 ) ) ;
524
+
525
525
// Always get last segment for media sub folder simulation. E.g 1001, 1002
526
- var all = prefixes . Union ( blobPrefixes ) ;
526
+ var all = prefixes . Union ( blobPrefixes ) . Where ( x => ! x . Equals ( path + "/" ) ) ;
527
+
527
528
return all . Select ( cd => cd . TrimEnd ( '/' ) ) ;
528
529
}
529
530
@@ -853,7 +854,7 @@ private AzureBlobDirectory GetDirectoryReference(string path)
853
854
Current . Logger . Debug < AzureBlobFileSystem > ( $ "GetDirectoryReference(path) method executed with path:{ path } ") ;
854
855
855
856
string blobPath = this . FixPath ( path ) ;
856
- return new AzureBlobDirectory ( cloudBlobContainer , blobPath ) ;
857
+ return new AzureBlobDirectory ( cloudBlobContainer , blobPath ) ;
857
858
}
858
859
859
860
/// <summary>
You can’t perform that action at this time.
0 commit comments