diff --git a/framework/src/Volo.Abp.BlobStoring.FileSystem/Volo/Abp/BlobStoring/FileSystem/FileSystemBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.FileSystem/Volo/Abp/BlobStoring/FileSystem/FileSystemBlobProvider.cs index 23b8ea45d6..4de039982f 100644 --- a/framework/src/Volo.Abp.BlobStoring.FileSystem/Volo/Abp/BlobStoring/FileSystem/FileSystemBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring.FileSystem/Volo/Abp/BlobStoring/FileSystem/FileSystemBlobProvider.cs @@ -61,7 +61,8 @@ namespace Volo.Abp.BlobStoring.FileSystem protected virtual string CalculateBlobFilePath(BlobProviderArgs args) { - var blobPath = args.Configuration.GetFileSystemConfiguration().BasePath; + var fileSystemConfiguration = args.Configuration.GetFileSystemConfiguration(); + var blobPath = fileSystemConfiguration.BasePath; if (args.TenantId == null) { @@ -72,7 +73,12 @@ namespace Volo.Abp.BlobStoring.FileSystem blobPath = Path.Combine(blobPath, "tenants", args.TenantId.Value.ToString("D")); } - blobPath = Path.Combine(blobPath, args.ContainerName, args.BlobName); + if (fileSystemConfiguration.AppendContainerNameToBasePath) + { + blobPath = Path.Combine(blobPath, args.ContainerName); + } + + blobPath = Path.Combine(blobPath, args.BlobName); return blobPath; } diff --git a/framework/src/Volo.Abp.BlobStoring.FileSystem/Volo/Abp/BlobStoring/FileSystem/FileSystemBlobProviderConfiguration.cs b/framework/src/Volo.Abp.BlobStoring.FileSystem/Volo/Abp/BlobStoring/FileSystem/FileSystemBlobProviderConfiguration.cs index f6a700d09a..442744c4f3 100644 --- a/framework/src/Volo.Abp.BlobStoring.FileSystem/Volo/Abp/BlobStoring/FileSystem/FileSystemBlobProviderConfiguration.cs +++ b/framework/src/Volo.Abp.BlobStoring.FileSystem/Volo/Abp/BlobStoring/FileSystem/FileSystemBlobProviderConfiguration.cs @@ -9,6 +9,15 @@ set => _containerConfiguration.SetConfiguration(FileSystemBlobProviderConfigurationNames.BasePath, Check.NotNullOrWhiteSpace(value, nameof(value))); } + /// + /// Default value: true. + /// + public bool AppendContainerNameToBasePath + { + get => _containerConfiguration.GetConfigurationOrDefault(FileSystemBlobProviderConfigurationNames.AppendContainerNameToBasePath, true); + set => _containerConfiguration.SetConfiguration(FileSystemBlobProviderConfigurationNames.BasePath, value); + } + private readonly BlobContainerConfiguration _containerConfiguration; public FileSystemBlobProviderConfiguration(BlobContainerConfiguration containerConfiguration) diff --git a/framework/src/Volo.Abp.BlobStoring.FileSystem/Volo/Abp/BlobStoring/FileSystem/FileSystemBlobProviderConfigurationNames.cs b/framework/src/Volo.Abp.BlobStoring.FileSystem/Volo/Abp/BlobStoring/FileSystem/FileSystemBlobProviderConfigurationNames.cs index 6670f6f76e..56991fa0ea 100644 --- a/framework/src/Volo.Abp.BlobStoring.FileSystem/Volo/Abp/BlobStoring/FileSystem/FileSystemBlobProviderConfigurationNames.cs +++ b/framework/src/Volo.Abp.BlobStoring.FileSystem/Volo/Abp/BlobStoring/FileSystem/FileSystemBlobProviderConfigurationNames.cs @@ -2,7 +2,7 @@ { public static class FileSystemBlobProviderConfigurationNames { - public const string BasePath = "BasePath"; - + public const string BasePath = "FileSystem.BasePath"; + public const string AppendContainerNameToBasePath = "FileSystem.AppendContainerNameToBasePath"; } } \ No newline at end of file