From 2976e1e20ef35775630a11f9fc7563ab5b6216f0 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期五, 30 十月 2026 19:12:29 +0800
Subject: [PATCH] fix(api): 修复全量接口测试发现的 500 系统异常

---
 yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java
index 12bab8a..98c6e50 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java
@@ -11,6 +11,7 @@
 import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.*;
 import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
 import cn.iocoder.yudao.module.infra.service.file.FileService;
+import com.google.common.util.concurrent.UncheckedExecutionException;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.Parameters;
@@ -117,7 +118,15 @@
         path = HttpUtils.decodeUrlPath(path);
 
         // 璇诲彇鍐呭
-        byte[] content = fileService.getFileContent(configId, path);
+        byte[] content;
+        try {
+            content = fileService.getFileContent(configId, path);
+        } catch (IllegalArgumentException | UncheckedExecutionException ex) {
+            // 鏂囦欢閰嶇疆涓嶅瓨鍦紙濡� configId 鏃犳晥锛夋椂锛屾寜璧勬簮涓嶅瓨鍦ㄨ繑鍥� 404锛岃�屼笉鏄� 500
+            log.warn("[getFileContent][configId({}) path({}) 鏂囦欢閰嶇疆涓嶅瓨鍦╙", configId, path);
+            response.setStatus(HttpStatus.NOT_FOUND.value());
+            return;
+        }
         if (content == null) {
             log.warn("[getFileContent][configId({}) path({}) 鏂囦欢涓嶅瓨鍦╙", configId, path);
             response.setStatus(HttpStatus.NOT_FOUND.value());

--
Gitblit v1.9.3