From 2b09bd2b208c8f6a9f2d7aaffeec9d01259e55e8 Mon Sep 17 00:00:00 2001 From: yzp Date: Wed, 12 Mar 2025 16:22:12 +0800 Subject: [PATCH] =?UTF-8?q?BUG=EF=BC=9A=E6=96=87=E4=BB=B6=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E6=9C=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin.NET.Core/Service/File/SysFileService.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Admin.NET/Admin.NET.Core/Service/File/SysFileService.cs b/Admin.NET/Admin.NET.Core/Service/File/SysFileService.cs index aabe40a3..86b2c760 100644 --- a/Admin.NET/Admin.NET.Core/Service/File/SysFileService.cs +++ b/Admin.NET/Admin.NET.Core/Service/File/SysFileService.cs @@ -1,4 +1,4 @@ -// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。 +// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。 // // 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。 // @@ -157,7 +157,15 @@ public class SysFileService : IDynamicApiController, ITransient [DisplayName("下载指定文件Base64格式")] public async Task DownloadFileBase64([FromBody] string url) { - var sysFile = await _sysFileRep.CopyNew().GetFirstAsync(u => u.Url == url) ?? throw Oops.Oh($"文件不存在"); + var db = _sysFileRep.CopyNew(); + db.Context.QueryFilter.Clear(); + var sysFile = await db.GetFirstAsync(u => u.Url == url); + if (sysFile==null) + { + $"文件{url}不存在,数据库记录中".LogError(); + throw Oops.Oh($"文件不存在"); + } + return await _customFileProvider.DownloadFileBase64Async(sysFile); }