From fec1341c1cb8e11cfbe3fa7dfabe447edb72b630 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期二, 27 十月 2026 15:12:43 +0800
Subject: [PATCH] refactor(auth): 移除多个模块中的权限校验注解

---
 yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java
index ca7db64..f3be15c 100644
--- a/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java
+++ b/yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java
@@ -1,10 +1,11 @@
 package cn.iocoder.yudao.module.infra.controller.admin.file;
 
+import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.io.IoUtil;
 import cn.hutool.core.util.StrUtil;
-import cn.hutool.core.util.URLUtil;
 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.http.HttpUtils;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
 import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
 import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.*;
@@ -27,7 +28,6 @@
 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;
@@ -75,7 +75,6 @@
     @GetMapping("/get")
     @Operation(summary = "鑾峰緱鏂囦欢")
     @Parameter(name = "id", description = "缂栧彿", required = true)
-    @PreAuthorize("@ss.hasPermission('infra:file:query')")
     public CommonResult<FileRespVO> getFile(@RequestParam("id") Long id) {
         return success(BeanUtils.toBean(fileService.getFile(id), FileRespVO.class));
     }
@@ -111,10 +110,10 @@
         if (StrUtil.isEmpty(path)) {
             throw new IllegalArgumentException("缁撳熬鐨� path 璺緞蹇呴』浼犻��");
         }
-        // 瑙g爜锛岃В鍐充腑鏂囪矾寰勭殑闂
+        // 瑙g爜锛岃В鍐充腑鏂囥��%銆�+ 绛夌壒娈婂瓧绗﹁矾寰勭殑闂
         // 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);
+        path = HttpUtils.decodeUrlPath(path);
 
         // 璇诲彇鍐呭
         byte[] content = fileService.getFileContent(configId, path);
@@ -123,12 +122,13 @@
             response.setStatus(HttpStatus.NOT_FOUND.value());
             return;
         }
-        writeAttachment(response, path, content);
+        FileDO file = fileService.getFileByConfigIdAndPath(configId, path);
+        String filename = file != null && StrUtil.isNotEmpty(file.getName()) ? file.getName() : FileUtil.getName(path);
+        writeAttachment(response, filename, content);
     }
 
     @GetMapping("/page")
     @Operation(summary = "鑾峰緱鏂囦欢鍒嗛〉")
-    @PreAuthorize("@ss.hasPermission('infra:file:query')")
     public CommonResult<PageResult<FileRespVO>> getFilePage(@Valid FilePageReqVO pageVO) {
         PageResult<FileDO> pageResult = fileService.getFilePage(pageVO);
         return success(BeanUtils.toBean(pageResult, FileRespVO.class));

--
Gitblit v1.9.3