🐛 修复本地存储下载时,错误的 contentType 类型导致无法正常下载的问题

This commit is contained in:
zhaojun
2022-08-01 15:17:29 +08:00
parent b079d03753
commit 27db6ed14a

View File

@@ -185,11 +185,12 @@ public class LocalServiceImpl extends ProxyTransferService<LocalParam> {
String fileName = file.getName();
headers.setContentDispositionFormData("attachment", StringUtils.encodeAllIgnoreSlashes(fileName));
return ResponseEntity
.ok()
.headers(headers)
.contentLength(file.length())
.contentType(MediaType.APPLICATION_OCTET_STREAM)
.body(new FileSystemResource(file));
}