提交 cdbbaedb 作者: 方治民

fix: 修复 MinIO 上传文件时 ContentType 可能根据平台不同导致为空问题

上级 9044c8b3
......@@ -12,8 +12,10 @@ import java.nio.file.Path;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Objects;
import java.util.Optional;
import lombok.Cleanup;
import lombok.NonNull;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
......@@ -88,7 +90,7 @@ public record Minio(MinioConfig config, MinioClient client) {
.bucket(config.getBucket())
.stream(is, -1, PutObjectArgs.MIN_MULTIPART_SIZE)
.object(object)
.contentType(contentType)
.contentType(Optional.ofNullable(contentType).orElse(MediaType.APPLICATION_OCTET_STREAM_VALUE))
.build();
return client.putObject(args);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论