演示环境文件大小限制

pull/789/head
Zheng Jie 2022-05-25 11:36:31 +08:00
parent 71279e3a40
commit caafb830bf
1 changed files with 2 additions and 3 deletions

View File

@ -252,8 +252,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
public static void checkSize(long maxSize, long size) { public static void checkSize(long maxSize, long size) {
// 1M // 1M
int len = 1024 * 1024; int len = 1024 * 1024;
maxSize = (long)(maxSize * len * 0.05); if (size > (maxSize * len * 0.05)) {
if (size > maxSize) {
throw new BadRequestException("文件超出规定大小: " + 50 + "KB"); throw new BadRequestException("文件超出规定大小: " + 50 + "KB");
} }
} }