Skip to content

Commit 5e9e2b3

Browse files
author
Warren Buckley
committed
Implements new changes to work for V8 File Systems
1 parent 7173490 commit 5e9e2b3

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/UmbracoFileSystemProviders.Azure/AzureFileSystemComponent.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ public class AzureFileSystemComponent : IComponent
1616
/// The configuration key for disabling the virtual path provider.
1717
/// </summary>
1818
private const string DisableVirtualPathProviderKey = Constants.Configuration.DisableVirtualPathProviderKey;
19-
private readonly IMediaFileSystem mediaFileSystem;
19+
private readonly SupportingFileSystems supportingFileSystems;
2020

21-
public AzureFileSystemComponent(IMediaFileSystem mediaFileSystem)
21+
public AzureFileSystemComponent(SupportingFileSystems supportingFileSystems)
2222
{
23-
this.mediaFileSystem = mediaFileSystem;
23+
this.supportingFileSystems = supportingFileSystems;
2424
}
2525

2626
public void Initialize()
@@ -29,13 +29,10 @@ public void Initialize()
2929
&& ConfigurationManager.AppSettings[DisableVirtualPathProviderKey]
3030
.Equals("true", StringComparison.InvariantCultureIgnoreCase);
3131

32-
33-
IFileSystem fileSystem = this.mediaFileSystem.Unwrap();
34-
bool isAzureBlobFileSystem = fileSystem is AzureBlobFileSystem;
35-
36-
if (!disable && isAzureBlobFileSystem)
32+
var azureFs = this.supportingFileSystems.For<IMediaFileSystem>() as AzureBlobFileSystem;
33+
if (!disable && azureFs != null)
3734
{
38-
AzureFileSystem azureFileSystem = ((AzureBlobFileSystem)fileSystem).FileSystem;
35+
AzureFileSystem azureFileSystem = azureFs.FileSystem;
3936

4037
// ReSharper disable once ConvertIfStatementToConditionalTernaryExpression
4138
if (azureFileSystem.UseDefaultRoute)

src/UmbracoFileSystemProviders.Azure/AzureFileSystemComposer.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ public void Compose(Composition composition)
3838
if (string.IsNullOrEmpty(usePrivateContainer))
3939
throw new ArgumentNullOrEmptyException("usePrivateContainer", $"The Azure File System is missing the value '{Constants.Configuration.UsePrivateContainer}' from AppSettings");
4040

41-
42-
composition.RegisterFileSystem<IMediaFileSystem, MediaFileSystem>(_ => new AzureBlobFileSystem(containerName, rootUrl, connectionString, maxDays, useDefaultRoute, usePrivateContainer));
41+
composition.SetMediaFileSystem(_ => new AzureBlobFileSystem(containerName, rootUrl, connectionString, maxDays, useDefaultRoute, usePrivateContainer));
4342
composition.Components().Append<AzureFileSystemComponent>();
4443
}
4544
}

0 commit comments

Comments
 (0)