Skip to content

Commit 1470979

Browse files
C#6 🚀
1 parent a1f030b commit 1470979

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/UmbracoFileSystemProviders.Azure/AzureFileSystem.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace Our.Umbraco.FileSystemProviders.Azure
1616
using Microsoft.WindowsAzure.Storage.Blob;
1717

1818
/// <summary>
19-
/// A singleton class for communicating with Azure Blob Storage.
19+
/// A class for communicating with Azure Blob Storage.
2020
/// </summary>
2121
internal class AzureFileSystem : IFileSystem
2222
{
@@ -43,12 +43,12 @@ internal class AzureFileSystem : IFileSystem
4343
/// <summary>
4444
/// A list of <see cref="AzureFileSystem"/>.
4545
/// </summary>
46-
private static List<AzureFileSystem> fileSystems;
46+
private static List<AzureFileSystem> fileSystems = new List<AzureFileSystem>();
4747

4848
/// <summary>
4949
/// The root url.
5050
/// </summary>
51-
private readonly string rootUrl;
51+
private readonly string rootBlobUrl;
5252

5353
/// <summary>
5454
/// The cloud media blob container.
@@ -70,7 +70,7 @@ internal AzureFileSystem(string containerName, string rootUrl, string connection
7070
{
7171
if (string.IsNullOrWhiteSpace(containerName))
7272
{
73-
throw new ArgumentNullException("containerName");
73+
throw new ArgumentNullException(nameof(containerName));
7474
}
7575

7676
this.DisableVirtualPathProvider = ConfigurationManager.AppSettings[DisableVirtualPathProviderKey] != null
@@ -100,7 +100,7 @@ internal AzureFileSystem(string containerName, string rootUrl, string connection
100100
rootUrl = rootUrl.Trim() + "/";
101101
}
102102

103-
this.rootUrl = rootUrl + containerName + "/";
103+
this.rootBlobUrl = rootUrl + containerName + "/";
104104
this.ContainerName = containerName;
105105
this.MaxDays = maxDays;
106106
this.UseDefaultRoute = useDefaultRoute;
@@ -153,7 +153,7 @@ public AzureFileSystem GetInstance(string containerName, string rootUrl, string
153153
{
154154
lock (Locker)
155155
{
156-
if (fileSystems.SingleOrDefault(fs => fs.ContainerName == containerName && fs.rootUrl == rootUrl) == null)
156+
if (fileSystems.SingleOrDefault(fs => fs.ContainerName == containerName && fs.rootBlobUrl == rootUrl) == null)
157157
{
158158
int max;
159159
if (!int.TryParse(maxDays, out max))
@@ -179,7 +179,7 @@ public AzureFileSystem GetInstance(string containerName, string rootUrl, string
179179
}
180180
}
181181

182-
return fileSystems.SingleOrDefault(fs => fs.ContainerName == containerName && fs.rootUrl == rootUrl);
182+
return fileSystems.SingleOrDefault(fs => fs.ContainerName == containerName && fs.rootBlobUrl == rootUrl);
183183
}
184184
}
185185

@@ -427,14 +427,14 @@ public IEnumerable<string> GetFiles(string path, string filter)
427427

428428
if (filter.Equals("*.*", StringComparison.InvariantCultureIgnoreCase))
429429
{
430-
return url.Substring(this.rootUrl.Length);
430+
return url.Substring(this.rootBlobUrl.Length);
431431
}
432432

433433
// Filter by name.
434434
filter = filter.TrimStart('*');
435435
if (url.IndexOf(filter, StringComparison.InvariantCultureIgnoreCase) > -1)
436436
{
437-
return url.Substring(this.rootUrl.Length);
437+
return url.Substring(this.rootBlobUrl.Length);
438438
}
439439

440440
return null;
@@ -592,7 +592,7 @@ private string ResolveUrl(string path, bool relative)
592592
// First create the full url
593593
string fixedPath = this.FixPath(path);
594594

595-
Uri url = new Uri(new Uri(this.rootUrl, UriKind.Absolute), fixedPath);
595+
Uri url = new Uri(new Uri(this.rootBlobUrl, UriKind.Absolute), fixedPath);
596596

597597
if (!relative)
598598
{
@@ -628,9 +628,9 @@ private string FixPath(string path)
628628
}
629629

630630
// Strip root url
631-
if (path.StartsWith(this.rootUrl, StringComparison.InvariantCultureIgnoreCase))
631+
if (path.StartsWith(this.rootBlobUrl, StringComparison.InvariantCultureIgnoreCase))
632632
{
633-
path = path.Substring(this.rootUrl.Length);
633+
path = path.Substring(this.rootBlobUrl.Length);
634634
}
635635

636636
// Strip default route

0 commit comments

Comments
 (0)