From 8408b39fbbf835c9b1af6ea2d3c9ccb0d50a00c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com> Date: Wed, 11 Dec 2024 19:48:37 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E6=96=87=E4=BB=B6=E6=9C=AA=E6=89=BE?= =?UTF-8?q?=E5=88=B0=EF=BC=8C=E4=B8=8D=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Yi.Framework.Rbac.Application/Services/FileService.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/FileService.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/FileService.cs index fc999707..011be87f 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/FileService.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/FileService.cs @@ -37,7 +37,7 @@ namespace Yi.Framework.Rbac.Application.Services { var path = await GetReturnPathAsync(code, isThumbnail); - if (!File.Exists(path)) + if (path is null||!File.Exists(path)) { return new NotFoundResult(); // throw new UserFriendlyException("文件不存在",code:"404"); @@ -53,12 +53,13 @@ namespace Yi.Framework.Rbac.Application.Services return new FileContentResult(steam, fileContentType ?? @"text/plain"); } - public async Task GetReturnPathAsync(Guid code, bool? isThumbnail) + public async Task GetReturnPathAsync(Guid code, bool? isThumbnail) { var file = await _repository.GetAsync(x => x.Id == code); if (file is null) { - throw new UserFriendlyException("文件编号未匹配", "404"); + return null; + // throw new UserFriendlyException("文件编号未匹配", "404"); } var path = file.FilePath; //如果为缩略图,需要修改路径