@@ -16,7 +16,7 @@ namespace Our.Umbraco.FileSystemProviders.Azure
16
16
using Microsoft . WindowsAzure . Storage . Blob ;
17
17
18
18
/// <summary>
19
- /// A singleton class for communicating with Azure Blob Storage.
19
+ /// A class for communicating with Azure Blob Storage.
20
20
/// </summary>
21
21
internal class AzureFileSystem : IFileSystem
22
22
{
@@ -43,12 +43,12 @@ internal class AzureFileSystem : IFileSystem
43
43
/// <summary>
44
44
/// A list of <see cref="AzureFileSystem"/>.
45
45
/// </summary>
46
- private static List < AzureFileSystem > fileSystems ;
46
+ private static List < AzureFileSystem > fileSystems = new List < AzureFileSystem > ( ) ;
47
47
48
48
/// <summary>
49
49
/// The root url.
50
50
/// </summary>
51
- private readonly string rootUrl ;
51
+ private readonly string rootBlobUrl ;
52
52
53
53
/// <summary>
54
54
/// The cloud media blob container.
@@ -70,7 +70,7 @@ internal AzureFileSystem(string containerName, string rootUrl, string connection
70
70
{
71
71
if ( string . IsNullOrWhiteSpace ( containerName ) )
72
72
{
73
- throw new ArgumentNullException ( " containerName" ) ;
73
+ throw new ArgumentNullException ( nameof ( containerName ) ) ;
74
74
}
75
75
76
76
this . DisableVirtualPathProvider = ConfigurationManager . AppSettings [ DisableVirtualPathProviderKey ] != null
@@ -100,7 +100,7 @@ internal AzureFileSystem(string containerName, string rootUrl, string connection
100
100
rootUrl = rootUrl . Trim ( ) + "/" ;
101
101
}
102
102
103
- this . rootUrl = rootUrl + containerName + "/" ;
103
+ this . rootBlobUrl = rootUrl + containerName + "/" ;
104
104
this . ContainerName = containerName ;
105
105
this . MaxDays = maxDays ;
106
106
this . UseDefaultRoute = useDefaultRoute ;
@@ -153,7 +153,7 @@ public AzureFileSystem GetInstance(string containerName, string rootUrl, string
153
153
{
154
154
lock ( Locker )
155
155
{
156
- if ( fileSystems . SingleOrDefault ( fs => fs . ContainerName == containerName && fs . rootUrl == rootUrl ) == null )
156
+ if ( fileSystems . SingleOrDefault ( fs => fs . ContainerName == containerName && fs . rootBlobUrl == rootUrl ) == null )
157
157
{
158
158
int max ;
159
159
if ( ! int . TryParse ( maxDays , out max ) )
@@ -179,7 +179,7 @@ public AzureFileSystem GetInstance(string containerName, string rootUrl, string
179
179
}
180
180
}
181
181
182
- return fileSystems . SingleOrDefault ( fs => fs . ContainerName == containerName && fs . rootUrl == rootUrl ) ;
182
+ return fileSystems . SingleOrDefault ( fs => fs . ContainerName == containerName && fs . rootBlobUrl == rootUrl ) ;
183
183
}
184
184
}
185
185
@@ -427,14 +427,14 @@ public IEnumerable<string> GetFiles(string path, string filter)
427
427
428
428
if ( filter . Equals ( "*.*" , StringComparison . InvariantCultureIgnoreCase ) )
429
429
{
430
- return url . Substring ( this . rootUrl . Length ) ;
430
+ return url . Substring ( this . rootBlobUrl . Length ) ;
431
431
}
432
432
433
433
// Filter by name.
434
434
filter = filter . TrimStart ( '*' ) ;
435
435
if ( url . IndexOf ( filter , StringComparison . InvariantCultureIgnoreCase ) > - 1 )
436
436
{
437
- return url . Substring ( this . rootUrl . Length ) ;
437
+ return url . Substring ( this . rootBlobUrl . Length ) ;
438
438
}
439
439
440
440
return null ;
@@ -592,7 +592,7 @@ private string ResolveUrl(string path, bool relative)
592
592
// First create the full url
593
593
string fixedPath = this . FixPath ( path ) ;
594
594
595
- Uri url = new Uri ( new Uri ( this . rootUrl , UriKind . Absolute ) , fixedPath ) ;
595
+ Uri url = new Uri ( new Uri ( this . rootBlobUrl , UriKind . Absolute ) , fixedPath ) ;
596
596
597
597
if ( ! relative )
598
598
{
@@ -628,9 +628,9 @@ private string FixPath(string path)
628
628
}
629
629
630
630
// Strip root url
631
- if ( path . StartsWith ( this . rootUrl , StringComparison . InvariantCultureIgnoreCase ) )
631
+ if ( path . StartsWith ( this . rootBlobUrl , StringComparison . InvariantCultureIgnoreCase ) )
632
632
{
633
- path = path . Substring ( this . rootUrl . Length ) ;
633
+ path = path . Substring ( this . rootBlobUrl . Length ) ;
634
634
}
635
635
636
636
// Strip default route
0 commit comments