diff --git a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobContainer.cs b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobContainer.cs index 859c5f85be..700549e957 100644 --- a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobContainer.cs +++ b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobContainer.cs @@ -151,7 +151,7 @@ namespace Volo.Abp.BlobStoring string name, CancellationToken cancellationToken = default) { - return Provider.GetAsync( + var stream = Provider.GetOrNullAsync( new BlobProviderGetArgs( ContainerName, Configuration, @@ -160,6 +160,14 @@ namespace Volo.Abp.BlobStoring CancellationTokenProvider.FallbackToProvider(cancellationToken) ) ); + + if (stream == null) + { + //TODO: Consider to throw some type of "not found" exception and handle on the HTTP status side + throw new AbpException($"Could not found the requested BLOB '{name}' in the container '{ContainerName}'!"); + } + + return stream; } public virtual Task GetOrNullAsync( diff --git a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobProviderBase.cs b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobProviderBase.cs index eb047acf2d..b1aafb6903 100644 --- a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobProviderBase.cs +++ b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/BlobProviderBase.cs @@ -11,18 +11,6 @@ namespace Volo.Abp.BlobStoring public abstract Task ExistsAsync(BlobProviderExistsArgs args); - public virtual async Task GetAsync(BlobProviderGetArgs args) - { - var result = await GetOrNullAsync(args); - if (result == null) - { - //TODO: Consider to throw some type of "not found" exception and handle on the HTTP status side - throw new AbpException($"Could not found the requested BLOB '{args.BlobName}' in the container '{args.ContainerName}'!"); - } - - return result; - } - public abstract Task GetOrNullAsync(BlobProviderGetArgs args); } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/IBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/IBlobProvider.cs index a1546e3159..d7332589c5 100644 --- a/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/IBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/IBlobProvider.cs @@ -12,8 +12,6 @@ namespace Volo.Abp.BlobStoring Task ExistsAsync(BlobProviderExistsArgs args); - Task GetAsync(BlobProviderGetArgs args); - Task GetOrNullAsync(BlobProviderGetArgs args); } } \ No newline at end of file