修复 Debug EML 上传大小限制
This commit is contained in:
@@ -7,6 +7,11 @@ spring:
|
|||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
flyway:
|
flyway:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
# dev Debug EML multipart 上限必须不小于业务文件上限,避免请求进入 Controller 前被 413 拦截。
|
||||||
|
max-file-size: ${DEBUG_EML_UPLOAD_DEV_MAX_FILE_BYTES:${DEBUG_EML_UPLOAD_MAX_FILE_BYTES:10485760}}
|
||||||
|
max-request-size: ${DEBUG_EML_UPLOAD_DEV_MAX_REQUEST_BYTES:${DEBUG_EML_UPLOAD_MAX_REQUEST_BYTES:12582912}}
|
||||||
|
|
||||||
source-message:
|
source-message:
|
||||||
original-read:
|
original-read:
|
||||||
|
|||||||
@@ -7,6 +7,11 @@ spring:
|
|||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
flyway:
|
flyway:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
# prod Debug EML 如被显式开启,multipart 上限必须先放行到业务文件上限,再由服务层做受控校验。
|
||||||
|
max-file-size: ${DEBUG_EML_UPLOAD_PROD_MAX_FILE_BYTES:${DEBUG_EML_UPLOAD_MAX_FILE_BYTES:10485760}}
|
||||||
|
max-request-size: ${DEBUG_EML_UPLOAD_PROD_MAX_REQUEST_BYTES:${DEBUG_EML_UPLOAD_MAX_REQUEST_BYTES:12582912}}
|
||||||
|
|
||||||
source-message:
|
source-message:
|
||||||
original-read:
|
original-read:
|
||||||
|
|||||||
@@ -7,6 +7,11 @@ spring:
|
|||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
flyway:
|
flyway:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
# test Debug EML multipart 上限必须不小于业务文件上限,避免请求进入 Controller 前被 413 拦截。
|
||||||
|
max-file-size: ${DEBUG_EML_UPLOAD_TEST_MAX_FILE_BYTES:${DEBUG_EML_UPLOAD_MAX_FILE_BYTES:10485760}}
|
||||||
|
max-request-size: ${DEBUG_EML_UPLOAD_TEST_MAX_REQUEST_BYTES:${DEBUG_EML_UPLOAD_MAX_REQUEST_BYTES:12582912}}
|
||||||
|
|
||||||
source-message:
|
source-message:
|
||||||
original-read:
|
original-read:
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ spring:
|
|||||||
default: dev
|
default: dev
|
||||||
flyway:
|
flyway:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
# Debug EML 默认允许 10MB 文件;request 上限略大于文件上限,给 multipart 边界和字段留空间。
|
||||||
|
max-file-size: ${DEBUG_EML_UPLOAD_MAX_FILE_BYTES:10485760}
|
||||||
|
max-request-size: ${DEBUG_EML_UPLOAD_MAX_REQUEST_BYTES:12582912}
|
||||||
|
|
||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
configuration:
|
configuration:
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package cn.nianxx.thhotel.platform.debug.service;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
import cn.nianxx.thhotel.ThHotelApplication;
|
||||||
|
import cn.nianxx.thhotel.platform.debug.service.impl.DebugEmlSuperAgentProperties;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.autoconfigure.web.servlet.MultipartProperties;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.ActiveProfiles;
|
||||||
|
|
||||||
|
@SpringBootTest(
|
||||||
|
classes = ThHotelApplication.class,
|
||||||
|
properties = "debug.eml-upload.max-file-bytes=10485760")
|
||||||
|
@ActiveProfiles("test")
|
||||||
|
class DebugEmlMultipartConfigurationTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MultipartProperties multipartProperties;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DebugEmlSuperAgentProperties debugEmlProperties;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldAllowMultipartRequestBeforeDebugEmlBusinessLimit() {
|
||||||
|
assertThat(multipartProperties.getMaxFileSize().toBytes())
|
||||||
|
.isGreaterThanOrEqualTo(debugEmlProperties.getMaxFileBytes());
|
||||||
|
assertThat(multipartProperties.getMaxRequestSize().toBytes())
|
||||||
|
.isGreaterThan(debugEmlProperties.getMaxFileBytes());
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user