lyhzzz 1 年之前
父节点
当前提交
c7ccc11bd3
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/main/java/com/fdkankan/fusion/service/impl/UploadService.java

+ 2 - 2
src/main/java/com/fdkankan/fusion/service/impl/UploadService.java

@@ -88,7 +88,7 @@ public class UploadService {
             if(newName){
             if(newName){
                 fileName = UUID.randomUUID().toString().replace("-","") ;
                 fileName = UUID.randomUUID().toString().replace("-","") ;
             }else {
             }else {
-                fileName= URLEncoder.encode(fileName.substring(0,fileName.lastIndexOf(".")),"utf-8");
+                fileName= fileName.substring(0,fileName.lastIndexOf("."));
             }
             }
             if(fileName.length() >50){
             if(fileName.length() >50){
                 fileName =  fileName.substring(0,50);
                 fileName =  fileName.substring(0,50);
@@ -100,7 +100,7 @@ public class UploadService {
             if(!uploadToOssUtil.existKey(filePathAdd + fileName + suffixName)){
             if(!uploadToOssUtil.existKey(filePathAdd + fileName + suffixName)){
                 throw new BusinessException(ResultCode.UPLOAD_ERROR.code,ResultCode.UPLOAD_ERROR.msg);
                 throw new BusinessException(ResultCode.UPLOAD_ERROR.code,ResultCode.UPLOAD_ERROR.msg);
             }
             }
-            return queryPath +filePathAdd+ fileName + suffixName;
+            return queryPath +filePathAdd+ URLEncoder.encode(fileName,"utf-8") + suffixName;
         }catch (Exception e){
         }catch (Exception e){
             log.info("upload-error:{}",e);
             log.info("upload-error:{}",e);
             throw new BusinessException(ResultCode.UPLOAD_ERROR.code,ResultCode.UPLOAD_ERROR.msg);
             throw new BusinessException(ResultCode.UPLOAD_ERROR.code,ResultCode.UPLOAD_ERROR.msg);