优化数据存储展示

This commit is contained in:
2025-12-23 18:53:41 +08:00
parent 5134d2242b
commit 2d9c14b873
4 changed files with 11 additions and 7 deletions

View File

@@ -25,6 +25,7 @@ import javax.annotation.PostConstruct;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
@@ -447,7 +448,10 @@ public class MinioService implements IMinioService {
String mediaType = org.apache.commons.lang3.StringUtils.isBlank(contentType) ?
MediaType.APPLICATION_OCTET_STREAM_VALUE : contentType;
response.setContentType(mediaType);
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, encodedFileName);
String encodeFileName = URLEncoder.encode(encodedFileName, "UTF-8");
encodeFileName = encodeFileName.replaceAll("\\+", "%20");
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=\"" + encodeFileName + "\";filename*=utf-8");
response.setHeader(HttpHeaders.ACCEPT_RANGES, "bytes");
response.addHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(fileSize));