使用对象存储时,文件管理的在线预览文件中的下载地址修正

This commit is contained in:
thinkgem
2024-12-04 14:17:35 +08:00
parent 6984e97cd2
commit bd8bd10ed5
2 changed files with 3 additions and 2 deletions

View File

@@ -69,7 +69,7 @@ public class FileUploadController extends BaseController {
@RequestMapping(value = "/download/{fileUploadId}")
public String downloadFile(@PathVariable("fileUploadId") String fileUploadId, String preview, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
FileUpload fileUpload = fileUploadService.getFile(new FileUpload(fileUploadId));
return fileUploadService.downloadFile(fileUpload, preview, request, response);
return fileUploadService.downloadFile(fileUpload, preview, "file", request, response);
}
/**

View File

@@ -49,7 +49,8 @@ public class UserfilesController extends BaseController {
String uid = request.getParameter("uid");
if (StringUtils.isNotBlank(url) && StringUtils.isNotBlank(uid)){
fileUrl = url; //EncodeUtils.decodeUrl(url); 不用解码,否则腾讯云存储的时候预览不能显示
fileUri = Global.getCtxPath() + Global.getAdminPath() + "/file/download/" + uid;
String type = StringUtils.defaultIfBlank(request.getParameter("type"), "file");
fileUri = Global.getCtxPath() + Global.getAdminPath() + "/" + type + "/download/" + uid;
filePath = fileName;
} else if (StringUtils.isNotBlank(fileName)){
fileUri += "?fileName=" + EncodeUtils.encodeUrl(fileName);