lyhzzz 1 tahun lalu
induk
melakukan
c7ccc11bd3

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

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