Browse Source

Handle null in Region/ServiceURL setters and tighten nullable hints

- Clear configuration entry when Region or ServiceURL is set to null
- Annotate DeleteObjectsAsync prefix and continuationToken as nullable
- Replace vague Region placeholder in aws.md example
pull/22962/head
maliming 4 months ago
parent
commit
fd3dc1fc95
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 2
      docs/en/framework/infrastructure/blob-storing/aws.md
  2. 20
      framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/AwsBlobProviderConfiguration.cs
  3. 4
      framework/test/Volo.Abp.BlobStoring.Aws.Tests/Volo/Abp/BlobStoring/Aws/AbpBlobStoringAwsTestModule.cs

2
docs/en/framework/infrastructure/blob-storing/aws.md

@ -41,7 +41,7 @@ Configure<AbpBlobStoringOptions>(options =>
Aws.UseTemporaryFederatedCredentials = "set true to use temporary federated credentials"; Aws.UseTemporaryFederatedCredentials = "set true to use temporary federated credentials";
Aws.ProfileName = "the name of the profile to get credentials from"; Aws.ProfileName = "the name of the profile to get credentials from";
Aws.ProfilesLocation = "the path to the aws credentials file to look at"; Aws.ProfilesLocation = "the path to the aws credentials file to look at";
Aws.Region = "the system name of the service"; Aws.Region = "the AWS region system name, e.g. us-east-1";
Aws.ServiceURL = "custom service URL for S3-compatible APIs (optional)"; Aws.ServiceURL = "custom service URL for S3-compatible APIs (optional)";
Aws.Name = "the name of the federated user"; Aws.Name = "the name of the federated user";
Aws.Policy = "policy"; Aws.Policy = "policy";

20
framework/src/Volo.Abp.BlobStoring.Aws/Volo/Abp/BlobStoring/Aws/AwsBlobProviderConfiguration.cs

@ -64,7 +64,15 @@ public class AwsBlobProviderConfiguration
/// </summary> /// </summary>
public string? Region { public string? Region {
get => _containerConfiguration.GetConfigurationOrDefault<string>(AwsBlobProviderConfigurationNames.Region); get => _containerConfiguration.GetConfigurationOrDefault<string>(AwsBlobProviderConfigurationNames.Region);
set => _containerConfiguration.SetConfiguration(AwsBlobProviderConfigurationNames.Region, value); set
{
if (value == null)
{
_containerConfiguration.ClearConfiguration(AwsBlobProviderConfigurationNames.Region);
return;
}
_containerConfiguration.SetConfiguration(AwsBlobProviderConfigurationNames.Region, value);
}
} }
/// <summary> /// <summary>
@ -74,7 +82,15 @@ public class AwsBlobProviderConfiguration
/// </summary> /// </summary>
public string? ServiceURL { public string? ServiceURL {
get => _containerConfiguration.GetConfigurationOrDefault<string>(AwsBlobProviderConfigurationNames.ServiceURL); get => _containerConfiguration.GetConfigurationOrDefault<string>(AwsBlobProviderConfigurationNames.ServiceURL);
set => _containerConfiguration.SetConfiguration(AwsBlobProviderConfigurationNames.ServiceURL, value); set
{
if (value == null)
{
_containerConfiguration.ClearConfiguration(AwsBlobProviderConfigurationNames.ServiceURL);
return;
}
_containerConfiguration.SetConfiguration(AwsBlobProviderConfigurationNames.ServiceURL, value);
}
} }
/// <summary> /// <summary>

4
framework/test/Volo.Abp.BlobStoring.Aws.Tests/Volo/Abp/BlobStoring/Aws/AbpBlobStoringAwsTestModule.cs

@ -139,9 +139,9 @@ public class AbpBlobStoringAwsTestModule : AbpModule
} }
} }
private async Task DeleteObjectsAsync(AmazonS3Client client, string prefix) private async Task DeleteObjectsAsync(AmazonS3Client client, string? prefix)
{ {
string continuationToken = null; string? continuationToken = null;
do do
{ {
var listResponse = await client.ListObjectsV2Async(new ListObjectsV2Request var listResponse = await client.ListObjectsV2Async(new ListObjectsV2Request

Loading…
Cancel
Save