文件名限制。
This commit is contained in:
parent
4e2c53f64e
commit
2998a619a8
|
|
@ -155,7 +155,7 @@ public class EDDataServiceImpl implements EDDataService {
|
||||||
{
|
{
|
||||||
// 获取上级目录的名称
|
// 获取上级目录的名称
|
||||||
String fileName = edDataInfo.getDataName();
|
String fileName = edDataInfo.getDataName();
|
||||||
Assert.isTrue(EleCommonUtil.isFileNameValid(fileName), "文件名不符合规范,只能包含中文字符、下划线、连字符、加号、数字和英文字符");
|
Assert.isTrue(EleCommonUtil.isFileNameValid(fileName), "文件名不符合规范,只能包含中文字符、下划线、连字符、加号、数字和英文字符且长度小于32。");
|
||||||
|
|
||||||
Category categoryParent = new Category();
|
Category categoryParent = new Category();
|
||||||
categoryParent.setCategoryId(edDataInfo.getCategoryId());
|
categoryParent.setCategoryId(edDataInfo.getCategoryId());
|
||||||
|
|
@ -318,7 +318,7 @@ public class EDDataServiceImpl implements EDDataService {
|
||||||
String fileType = EleCommonUtil.getFileType(fileFullName);
|
String fileType = EleCommonUtil.getFileType(fileFullName);
|
||||||
// 获取文件名称
|
// 获取文件名称
|
||||||
String fileName = EleCommonUtil.getFileName(fileFullName);
|
String fileName = EleCommonUtil.getFileName(fileFullName);
|
||||||
Assert.isTrue(EleCommonUtil.isFileNameValid(fileName), "文件名不符合规范,只能包含中文字符、下划线、连字符、加号、数字和英文字符");
|
Assert.isTrue(EleCommonUtil.isFileNameValid(fileName), "文件名不符合规范,只能包含中文字符、下划线、连字符、加号、数字和英文字符且长度小于32。");
|
||||||
// 判断文件名称是否存在
|
// 判断文件名称是否存在
|
||||||
EDDataParams folderParames = new EDDataParams();
|
EDDataParams folderParames = new EDDataParams();
|
||||||
folderParames.setParentId(categoryId);
|
folderParames.setParentId(categoryId);
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,9 @@ public final class EleCommonUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isFileNameValid(String fileFullName) {
|
public static boolean isFileNameValid(String fileFullName) {
|
||||||
|
if (fileFullName.length() > 32) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return pattern.matcher(fileFullName).matches();
|
return pattern.matcher(fileFullName).matches();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue