|
@@ -1,6 +1,7 @@
|
|
|
package cn.iocoder.yudao.module.infra.framework.file.core.client.s3;
|
|
|
|
|
|
import cn.hutool.core.io.IoUtil;
|
|
|
+import cn.hutool.core.map.MapWrapper;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
import cn.iocoder.yudao.module.infra.framework.file.core.client.AbstractFileClient;
|
|
@@ -8,6 +9,8 @@ import io.minio.*;
|
|
|
import io.minio.http.Method;
|
|
|
|
|
|
import java.io.ByteArrayInputStream;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
@@ -103,7 +106,7 @@ public class S3FileClient extends AbstractFileClient<S3FileClientConfig> {
|
|
|
// 执行上传
|
|
|
client.putObject(PutObjectArgs.builder()
|
|
|
.bucket(config.getBucket()) // bucket 必须传递
|
|
|
- .contentType(type)
|
|
|
+ .contentType(type).headers(new HashMap(){{put("x-amz-acl", "public-read");}})
|
|
|
.object(path) // 相对路径作为 key
|
|
|
.stream(new ByteArrayInputStream(content), content.length, -1) // 文件内容
|
|
|
.build());
|