Browse Source

fix:【infra 基础设施】文件路径url "+"号解码问题

YunaiV 10 months ago
parent
commit
d40c2a39de

+ 5 - 2
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java

@@ -26,6 +26,7 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.nio.charset.StandardCharsets;
 import java.util.List;
 
 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@@ -99,8 +100,10 @@ public class FileController {
         if (StrUtil.isEmpty(path)) {
             throw new IllegalArgumentException("结尾的 path 路径必须传递");
         }
-        // 解码,解决中文路径的问题 https://gitee.com/zhijiantianya/ruoyi-vue-pro/pulls/807/
-        path = URLUtil.decode(path);
+        // 解码,解决中文路径的问题
+        // https://gitee.com/zhijiantianya/ruoyi-vue-pro/pulls/807/
+        // https://gitee.com/zhijiantianya/ruoyi-vue-pro/pulls/1432/
+        path = URLUtil.decode(path, StandardCharsets.UTF_8, false);
 
         // 读取内容
         byte[] content = fileService.getFileContent(configId, path);