Explorar el Código

文件名中文限制

lyhzzz hace 3 años
padre
commit
74d1174b97

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

@@ -21,6 +21,7 @@ public enum ResultCode {
     MERGER_VIDEO_ERROR(7013,"合成视频失败"),
     MERGER_VIDEO_ERROR(7013,"合成视频失败"),
     MODEL_NOT_EXIST(7014,"模型不存在"),
     MODEL_NOT_EXIST(7014,"模型不存在"),
     SCENE_NOT_EXIST(7015,"当前场景已被删除"),
     SCENE_NOT_EXIST(7015,"当前场景已被删除"),
+    UPLOAD_FILE_CHINA_NAME(7016,"文件名不能包含中文"),
 
 
     HOT_ICON_NOT_EXIST(7004,"热点icon不存在");
     HOT_ICON_NOT_EXIST(7004,"热点icon不存在");
 
 

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

@@ -79,6 +79,9 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
         if(StringUtils.isEmpty(fileName)){
         if(StringUtils.isEmpty(fileName)){
             throw new BusinessException(ResultCode.UPLOAD_FILE_NO_EXIST);
             throw new BusinessException(ResultCode.UPLOAD_FILE_NO_EXIST);
         }
         }
+        if(com.fdkankan.fusion.common.util.StringUtils.isChinese(fileName)){
+            throw new BusinessException(ResultCode.UPLOAD_FILE_TYPE_ERROR);
+        }
         if(!fileName.toLowerCase().contains("zip") && !fileName.toLowerCase().contains("rar")){
         if(!fileName.toLowerCase().contains("zip") && !fileName.toLowerCase().contains("rar")){
             throw new BusinessException(ResultCode.UPLOAD_FILE_TYPE_ERROR);
             throw new BusinessException(ResultCode.UPLOAD_FILE_TYPE_ERROR);
         }
         }