2024年6月11日 增加文件名称过滤
This commit is contained in:
parent
f1d366a3c6
commit
ac001486e5
|
@ -2,6 +2,7 @@ package org.jeecg.common.util;
|
||||||
|
|
||||||
import com.jcraft.jsch.*;
|
import com.jcraft.jsch.*;
|
||||||
import org.jeecg.common.constant.SymbolConstant;
|
import org.jeecg.common.constant.SymbolConstant;
|
||||||
|
import org.jeecg.common.util.filter.StrAttackFilter;
|
||||||
import org.jeecg.common.util.text.StringUtils;
|
import org.jeecg.common.util.text.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -191,7 +192,7 @@ public class SFTPUtil {
|
||||||
}
|
}
|
||||||
String fileName = null;
|
String fileName = null;
|
||||||
// 获取文件名
|
// 获取文件名
|
||||||
String orgName = file.getOriginalFilename();
|
String orgName = StrAttackFilter.filter(file.getOriginalFilename());
|
||||||
orgName = CommonUtils.getFileName(orgName);
|
orgName = CommonUtils.getFileName(orgName);
|
||||||
if(orgName.indexOf(SymbolConstant.SPOT)!=-1){
|
if(orgName.indexOf(SymbolConstant.SPOT)!=-1){
|
||||||
fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.lastIndexOf("."));
|
fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.lastIndexOf("."));
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.jeecg.common.constant.SymbolConstant;
|
||||||
import org.jeecg.common.exception.JeecgBootException;
|
import org.jeecg.common.exception.JeecgBootException;
|
||||||
import org.jeecg.common.util.*;
|
import org.jeecg.common.util.*;
|
||||||
import org.jeecg.common.util.filter.FileTypeFilter;
|
import org.jeecg.common.util.filter.FileTypeFilter;
|
||||||
|
import org.jeecg.common.util.filter.StrAttackFilter;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -183,7 +184,7 @@ public class CommonController {
|
||||||
}
|
}
|
||||||
// 获取文件名
|
// 获取文件名
|
||||||
if(fileName == null){
|
if(fileName == null){
|
||||||
String orgName = mf.getOriginalFilename();
|
String orgName = StrAttackFilter.filter(mf.getOriginalFilename());
|
||||||
if (orgName != null) {
|
if (orgName != null) {
|
||||||
orgName = CommonUtils.getFileName(orgName);
|
orgName = CommonUtils.getFileName(orgName);
|
||||||
if(orgName.contains(SymbolConstant.SPOT)){
|
if(orgName.contains(SymbolConstant.SPOT)){
|
||||||
|
|
Loading…
Reference in New Issue