From e7566d284b53b47577ade59c0b7e9262f9b43758 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Thu, 18 Jul 2024 23:27:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(web):=20=E4=BF=AE=E5=A4=8D=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=8A=E4=BC=A0=E5=BC=82=E5=B8=B8=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/autoconfigure/exception/GlobalExceptionHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/continew-starter-web/src/main/java/top/continew/starter/web/autoconfigure/exception/GlobalExceptionHandler.java b/continew-starter-web/src/main/java/top/continew/starter/web/autoconfigure/exception/GlobalExceptionHandler.java index ef1b0596..2a2b05a0 100644 --- a/continew-starter-web/src/main/java/top/continew/starter/web/autoconfigure/exception/GlobalExceptionHandler.java +++ b/continew-starter-web/src/main/java/top/continew/starter/web/autoconfigure/exception/GlobalExceptionHandler.java @@ -130,14 +130,14 @@ public R handleRequestTooBigException(MultipartException e, HttpServletReq msg = msg.concat(cause.getMessage().toLowerCase()); } if (msg.contains("size") && msg.contains("exceed")) { - sizeLimit = CharSequenceUtil.subBetween(msg, "maximum (", ")"); + sizeLimit = CharSequenceUtil.subBetween(msg, "the maximum size ", " for"); } else if (msg.contains("larger than")) { sizeLimit = CharSequenceUtil.subAfter(msg, "larger than ", true); } else { return defaultFail; } - String errorMsg = "请上传小于 %sMB 的文件".formatted(NumberUtil.parseLong(sizeLimit) / 1024 / 1024); + String errorMsg = "请上传小于 %sKB 的文件".formatted(NumberUtil.parseLong(sizeLimit) / 1024); log.warn("请求地址 [{}],上传文件失败,文件大小超过限制。", request.getRequestURI(), e); return R.fail(HttpStatus.BAD_REQUEST.value(), errorMsg); }