Bläddra i källkod

通用上传文件接口 增加把后缀名改为全小写逻辑

dengsixing 3 år sedan
förälder
incheckning
0fa887de66

+ 5 - 0
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneUploadServiceImpl.java

@@ -137,6 +137,11 @@ public class SceneUploadServiceImpl extends ServiceImpl<ISceneUploadMapper, Scen
             if(files.size() ==1 && StringUtils.isNotBlank(sendFileName)){
                 realFileName = sendFileName ;
             }
+
+            String oldExtName = cn.hutool.core.io.FileUtil.extName(realFileName);
+            String newExtName = oldExtName.toLowerCase();
+            realFileName = realFileName.substring(0, realFileName.lastIndexOf(oldExtName)) + newExtName;
+
             String ossPath = StrUtil.isNotBlank(uploadPath) ? uploadPath : (String.format(UploadFilePath.USER_EDIT_PATH ,sceneCode) + realFileName);
             try {
                 uploadToOssUtil.upload2(newFile.getPath(),ossPath);