diff --git a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN/Abp/OssManagement/FileAppServiceBase.cs b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN/Abp/OssManagement/FileAppServiceBase.cs index bef3d3b23..43deed492 100644 --- a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN/Abp/OssManagement/FileAppServiceBase.cs +++ b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN/Abp/OssManagement/FileAppServiceBase.cs @@ -6,6 +6,7 @@ using System.IO; using System.Threading.Tasks; using System.Web; +using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Content; using Volo.Abp.Features; @@ -103,6 +104,10 @@ public async virtual Task GetAsync(GetPublicFileInput inpu var ossContainer = OssContainerFactory.Create(); var ossObject = await ossContainer.GetObjectAsync(ossObjectRequest); + if (ossObject == null || ossObject.Content.IsNullOrEmpty()) + { + throw new BusinessException(code: OssManagementErrorCodes.ObjectNotFound); + } return new RemoteStreamContent(ossObject.Content); } diff --git a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN/Abp/OssManagement/PrivateFileAppService.cs b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN/Abp/OssManagement/PrivateFileAppService.cs index 1d381a64f..8326d3309 100644 --- a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN/Abp/OssManagement/PrivateFileAppService.cs +++ b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN/Abp/OssManagement/PrivateFileAppService.cs @@ -4,8 +4,10 @@ using Microsoft.Extensions.Caching.Distributed; using System; using System.Collections.Generic; +using System.IO; using System.Threading.Tasks; using System.Web; +using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Caching; using Volo.Abp.Content; @@ -61,6 +63,10 @@ public override async Task GetAsync(GetPublicFileInput inp var ossContainer = OssContainerFactory.Create(); var ossObject = await ossContainer.GetObjectAsync(ossObjectRequest); + if (ossObject == null || ossObject.Content.IsNullOrEmpty()) + { + throw new BusinessException(code: OssManagementErrorCodes.ObjectNotFound); + } return new RemoteStreamContent(ossObject.Content); } diff --git a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN/Abp/OssManagement/StaticFilesAppService.cs b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN/Abp/OssManagement/StaticFilesAppService.cs index 564235bd1..accc38261 100644 --- a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN/Abp/OssManagement/StaticFilesAppService.cs +++ b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN/Abp/OssManagement/StaticFilesAppService.cs @@ -1,7 +1,9 @@ using LINGYUN.Abp.Features.LimitValidation; using LINGYUN.Abp.OssManagement.Features; +using System.IO; using System.Threading.Tasks; using System.Web; +using Volo.Abp; using Volo.Abp.Content; using Volo.Abp.Features; @@ -35,6 +37,10 @@ public async virtual Task GetAsync(GetStaticFileInput inpu var ossContainer = OssContainerFactory.Create(); var ossObject = await ossContainer.GetObjectAsync(ossObjectRequest); + if (ossObject == null || ossObject.Content.IsNullOrEmpty()) + { + throw new BusinessException(code: OssManagementErrorCodes.ObjectNotFound); + } return new RemoteStreamContent(ossObject.Content, ossObject.Name); }