Skip to content

Commit bcead5e

Browse files
Fix IAzureBlobFileSystem instance creation
1 parent d34039a commit bcead5e

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/Umbraco.StorageProviders.AzureBlob/IO/AzureBlobFileSystemProvider.cs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using Microsoft.Extensions.Options;
55
using Umbraco.Cms.Core.Hosting;
66
using Umbraco.Cms.Core.IO;
7-
using Umbraco.Extensions;
87

98
namespace Umbraco.StorageProviders.AzureBlob.IO
109
{
@@ -43,24 +42,17 @@ public IAzureBlobFileSystem GetFileSystem(string name)
4342
{
4443
if (name == null) throw new ArgumentNullException(nameof(name));
4544

46-
return _fileSystems.GetOrAdd(name, CreateInstance);
47-
}
48-
49-
private IAzureBlobFileSystem CreateInstance(string name)
50-
{
51-
var options = _optionsMonitor.Get(name);
45+
return _fileSystems.GetOrAdd(name, name =>
46+
{
47+
var options = _optionsMonitor.Get(name);
5248

53-
return CreateInstance(options);
54-
}
55-
56-
private IAzureBlobFileSystem CreateInstance(AzureBlobFileSystemOptions options)
57-
{
58-
return new AzureBlobFileSystem(options, _hostingEnvironment, _ioHelper, _fileExtensionContentTypeProvider);
49+
return new AzureBlobFileSystem(options, _hostingEnvironment, _ioHelper, _fileExtensionContentTypeProvider);
50+
});
5951
}
6052

6153
private void OptionsOnChange(AzureBlobFileSystemOptions options, string name)
6254
{
63-
_fileSystems.TryUpdate(name, _ => CreateInstance(options));
55+
_fileSystems.TryRemove(name, out _);
6456
}
6557
}
6658
}

0 commit comments

Comments
 (0)