Commit d40c2a39de50f9e683cf5e9ceb02e5a61bda6889
1 parent
5ca386bf
fix:【infra 基础设施】文件路径url "+"号解码问题
Showing
1 changed file
with
5 additions
and
2 deletions
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; | @@ -26,6 +26,7 @@ import org.springframework.validation.annotation.Validated; | ||
| 26 | import org.springframework.web.bind.annotation.*; | 26 | import org.springframework.web.bind.annotation.*; |
| 27 | import org.springframework.web.multipart.MultipartFile; | 27 | import org.springframework.web.multipart.MultipartFile; |
| 28 | 28 | ||
| 29 | +import java.nio.charset.StandardCharsets; | ||
| 29 | import java.util.List; | 30 | import java.util.List; |
| 30 | 31 | ||
| 31 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 32 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| @@ -99,8 +100,10 @@ public class FileController { | @@ -99,8 +100,10 @@ public class FileController { | ||
| 99 | if (StrUtil.isEmpty(path)) { | 100 | if (StrUtil.isEmpty(path)) { |
| 100 | throw new IllegalArgumentException("结尾的 path 路径必须传递"); | 101 | throw new IllegalArgumentException("结尾的 path 路径必须传递"); |
| 101 | } | 102 | } |
| 102 | - // 解码,解决中文路径的问题 https://gitee.com/zhijiantianya/ruoyi-vue-pro/pulls/807/ | ||
| 103 | - path = URLUtil.decode(path); | 103 | + // 解码,解决中文路径的问题 |
| 104 | + // https://gitee.com/zhijiantianya/ruoyi-vue-pro/pulls/807/ | ||
| 105 | + // https://gitee.com/zhijiantianya/ruoyi-vue-pro/pulls/1432/ | ||
| 106 | + path = URLUtil.decode(path, StandardCharsets.UTF_8, false); | ||
| 104 | 107 | ||
| 105 | // 读取内容 | 108 | // 读取内容 |
| 106 | byte[] content = fileService.getFileContent(configId, path); | 109 | byte[] content = fileService.getFileContent(configId, path); |