2
0

feat: file module support i18n message

This commit is contained in:
zhangsz
2025-01-22 10:40:02 +08:00
parent 96bd946635
commit 575e101082
4 changed files with 8 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ import org.wfc.common.core.exception.file.FileNameLengthLimitExceededException;
import org.wfc.common.core.exception.file.FileSizeLimitExceededException;
import org.wfc.common.core.exception.file.InvalidExtensionException;
import org.wfc.common.core.utils.DateUtils;
import org.wfc.common.core.utils.MessageUtils;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.core.utils.file.FileTypeUtils;
import org.wfc.common.core.utils.file.MimeTypeUtils;
@@ -66,7 +67,7 @@ public class FileUploadUtils {
throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
InvalidExtensionException {
if (file == null || file.isEmpty()) {
throw new IllegalArgumentException("File must not be null or empty");
throw new IllegalArgumentException(MessageUtils.message("file.cannot.null"));
}
int fileNamelength = Objects.requireNonNull(file.getOriginalFilename()).length();
if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) {