!443 规范导出,防止跨域无法获取文件名称

Merge pull request !443 from twelvet/N/A
This commit is contained in:
lengleng 2023-11-16 12:44:57 +00:00 committed by Gitee
commit 2235875c09
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -70,6 +70,7 @@ public class GeneratorController {
byte[] data = outputStream.toByteArray();
response.reset();
response.setHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, HttpHeaders.CONTENT_DISPOSITION);
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, String.format("attachment; filename=%s.zip", tableIds));
response.addHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(data.length));
response.setContentType("application/octet-stream; charset=UTF-8");