Browse Source

fix(backend): 图片上传multipart大小限制+微信安全检测超过1M跳过

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Xiaogang Liao 1 month ago
parent
commit
598e7601

+ 4 - 0
cfc-backend/config/application.yml

@@ -12,6 +12,10 @@ server:
   port: 9082
 
 spring:
+  servlet:
+    multipart:
+      max-file-size: 50MB
+      max-request-size: 50MB
   datasource:
     driver-class-name: com.mysql.cj.jdbc.Driver
     url: jdbc:mysql://127.0.0.1:3306/zxyj?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true&createDatabaseIfNotExist=true

+ 6 - 0
cfc-backend/src/main/java/com/etotem/cfc/service/WechatService.java

@@ -320,6 +320,12 @@ public class WechatService implements WechatServiceInterface {
             return true;
         }
 
+        // 微信 img_sec_check 限制 1MB,超过则跳过检测(fail-open)
+        if (imageBytes.length > 1024 * 1024) {
+            log.info("图片大小 {} 超过微信安全检测上限 1MB,跳过检测", imageBytes.length);
+            return true;
+        }
+
         try {
             String accessToken = getAccessToken();
             String url = "https://api.weixin.qq.com/wxa/img_sec_check?access_token=" + accessToken;