diff --git a/ABAP_AS_WITH_POOL.jcoDestination b/ABAP_AS_WITH_POOL.jcoDestination index b7502c4..db406c2 100644 --- a/ABAP_AS_WITH_POOL.jcoDestination +++ b/ABAP_AS_WITH_POOL.jcoDestination @@ -1,5 +1,5 @@ #for tests only ! -#Fri Jul 05 10:21:23 CST 2024 +#Sat Jul 06 09:12:12 CST 2024 jco.destination.pool_capacity=10 jco.client.lang=ZH jco.client.ashost=172.19.0.125 @@ -7,5 +7,5 @@ jco.client.saprouter= jco.client.user=RFC jco.client.sysnr=00 jco.destination.peak_limit=10 -jco.client.passwd=u[=P1QVdS-RPMlLkq1i.Y!2.4N4Yel9cX%.$mi1AeSm065Ii +jco.client.passwd=wk11I1%y#bv4hL8`V_592O08%4oY%9d9LEvEX$N`b270Z~O5 jco.client.client=800 diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java index d38dc95..8e8003a 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java @@ -219,10 +219,30 @@ public class FileUploadUtils if(StringUtils.isNotEmpty(dir)){ template = "{}/{}/{}_{}.{}"; return StringUtils.format(template, dir,DateUtils.datePath(), - FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file)); + sanitizeFileName(FilenameUtils.getBaseName(file.getOriginalFilename())), Seq.getId(Seq.uploadSeqType), getExtension(file)); } return StringUtils.format(template, DateUtils.datePath(), - FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file)); + sanitizeFileName(FilenameUtils.getBaseName(file.getOriginalFilename())), Seq.getId(Seq.uploadSeqType), getExtension(file)); + } + + /** + * 文件名特殊字符处理 + * @param fileName + * @return + */ + public static String sanitizeFileName(String fileName) { + // 替换Windows不允许的文件名字符 + String sanitized = fileName.replaceAll("[\\\\/:*?\"<>|]", "_"); + sanitized = sanitized.replaceAll("\\.", "_"); + sanitized = sanitized.replaceAll("[#%]", "_"); + // 去除中间的空格 + sanitized = sanitized.replaceAll("\\s+", ""); + // 去除开头的空格 + sanitized = sanitized.replaceAll("^\\s+", ""); + // 去除结尾的空格 + sanitized = sanitized.replaceAll("\\s+$", ""); + // 应用其他特殊字符的替换规则... + return sanitized; } public static File getAbsoluteFile(String uploadDir, String fileName) throws IOException