mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-10-20 16:57:14 +08:00
refactor(common): 优化文件大小限制的错误提示信息
- 使用 Hutool 的 FileUtil 类将文件大小转换为更易读的格式 - 更新 README 中的 ContiNew Starter 版本号至 2.9.0
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package top.continew.admin.common.config.exception;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -94,7 +95,8 @@ public class GlobalExceptionHandler {
|
||||
} else {
|
||||
return defaultFail;
|
||||
}
|
||||
return R.fail(String.valueOf(HttpStatus.BAD_REQUEST.value()), "请上传小于 %s MB 的文件".formatted(Long.parseLong(sizeLimit) / 1024 / 1024));
|
||||
return R.fail(String.valueOf(HttpStatus.BAD_REQUEST.value()), "请上传小于 %s 的文件".formatted(FileUtil
|
||||
.readableFileSize(Long.parseLong(sizeLimit))));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user