chenrui
2025-05-09 1223edea2f56e5c3c0e36ea844c12ef55908e3c2
src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java
@@ -25,7 +25,7 @@
    /**
     * 默认大小 50M
     */
    public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
    public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024L;
    /**
     * 默认的文件名最大长度 100
@@ -102,8 +102,8 @@
            throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
            InvalidExtensionException
    {
        int fileNamelength = Objects.requireNonNull(file.getOriginalFilename()).length();
        if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH)
        int fileNameLength = Objects.requireNonNull(file.getOriginalFilename()).length();
        if (fileNameLength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH)
        {
            throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
        }
@@ -144,7 +144,8 @@
    {
        int dirLastIndex = RuoYiConfig.getProfile().length() + 1;
        String currentDir = StringUtils.substring(uploadDir, dirLastIndex);
        return Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName;
//        return Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName;
        return currentDir + "/" + fileName;
    }
    /**
@@ -193,7 +194,6 @@
                throw new InvalidExtensionException(allowedExtension, extension, fileName);
            }
        }
    }
    /**