lyhzzz 2 tahun lalu
induk
melakukan
b03e2e645d

+ 1 - 0
src/main/java/com/fdkankan/fusion/common/ResultCode.java

@@ -22,6 +22,7 @@ public enum ResultCode {
     MODEL_NOT_EXIST(7014,"模型不存在"),
     MODEL_NOT_EXIST(7014,"模型不存在"),
     SCENE_NOT_EXIST(7015,"当前场景已被删除"),
     SCENE_NOT_EXIST(7015,"当前场景已被删除"),
     UPLOAD_FILE_CHINA_NAME(7016,"文件名不能包含中文"),
     UPLOAD_FILE_CHINA_NAME(7016,"文件名不能包含中文"),
+    UPLOAD_FILE_NAME_TO_LONG(7017,"文件名超过长度限制"),
 
 
     HOT_ICON_NOT_EXIST(7004,"热点icon不存在");
     HOT_ICON_NOT_EXIST(7004,"热点icon不存在");
 
 

+ 3 - 0
src/main/java/com/fdkankan/fusion/service/impl/ModelServiceImpl.java

@@ -77,6 +77,9 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
         if(com.fdkankan.fusion.common.util.StringUtils.isChinese(fileName)){
         if(com.fdkankan.fusion.common.util.StringUtils.isChinese(fileName)){
             throw new BusinessException(ResultCode.UPLOAD_FILE_CHINA_NAME);
             throw new BusinessException(ResultCode.UPLOAD_FILE_CHINA_NAME);
         }
         }
+        if(fileName.length() >50){
+            throw new BusinessException(ResultCode.UPLOAD_FILE_NAME_TO_LONG);
+        }
         if(!fileName.toLowerCase().endsWith(".zip")){
         if(!fileName.toLowerCase().endsWith(".zip")){
             throw new BusinessException(ResultCode.UPLOAD_FILE_TYPE_ERROR);
             throw new BusinessException(ResultCode.UPLOAD_FILE_TYPE_ERROR);
         }
         }