123
This commit is contained in:
parent
9458858780
commit
c75a4bb981
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue