From be936ddf6b11615c3f3a1645ec71eb45234a880d Mon Sep 17 00:00:00 2001 From: AprilWind <2100166581@qq.com> Date: Wed, 16 Oct 2024 10:55:20 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8Doss=E4=BA=91=E5=8E=82?= =?UTF-8?q?=E5=95=86=E6=9B=B4=E6=94=B9=E5=AF=BC=E8=87=B4=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 ++-- .../java/org/dromara/common/oss/core/OssClient.java | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 7f961aac..e09ea4ca 100644 --- a/pom.xml +++ b/pom.xml @@ -49,8 +49,8 @@ 1.2.83 - 2.25.15 - 0.29.13 + 2.28.22 + 0.31.3 3.3.3 diff --git a/ruoyi-common/ruoyi-common-oss/src/main/java/org/dromara/common/oss/core/OssClient.java b/ruoyi-common/ruoyi-common-oss/src/main/java/org/dromara/common/oss/core/OssClient.java index bde26ae1..aff5490f 100644 --- a/ruoyi-common/ruoyi-common-oss/src/main/java/org/dromara/common/oss/core/OssClient.java +++ b/ruoyi-common/ruoyi-common-oss/src/main/java/org/dromara/common/oss/core/OssClient.java @@ -83,8 +83,8 @@ public class OssClient { StaticCredentialsProvider credentialsProvider = StaticCredentialsProvider.create( AwsBasicCredentials.create(properties.getAccessKey(), properties.getSecretKey())); - //MinIO 使用 HTTPS 限制使用域名访问,站点填域名。需要启用路径样式访问 - boolean isStyle = !StringUtils.containsAny(properties.getEndpoint(), OssConstant.CLOUD_SERVICE); + //使用对象存储服务时要求明确配置访问样式(路径样式或虚拟托管样式)。需要启用路径样式访问 + boolean isStyle = true; //创建AWS基于 CRT 的 S3 客户端 this.client = S3AsyncClient.crtBuilder() @@ -178,7 +178,9 @@ public class OssClient { .key(key) .contentMD5(StringUtils.isNotEmpty(md5Digest) ? md5Digest : null) .contentType(contentType) - .acl(getAccessPolicy().getObjectCannedACL()) + // 用于设置对象的访问控制列表(ACL)。不同云厂商对ACL的支持和实现方式有所不同, + // 因此根据具体的云服务提供商,你可能需要进行不同的配置(自行开启,阿里云有acl权限配置,腾讯云没有acl权限配置) + //.acl(getAccessPolicy().getObjectCannedACL()) .build()) .addTransferListener(LoggingTransferListener.create()) .source(filePath).build()); @@ -224,7 +226,9 @@ public class OssClient { y -> y.bucket(properties.getBucketName()) .key(key) .contentType(contentType) - .acl(getAccessPolicy().getObjectCannedACL()) + // 用于设置对象的访问控制列表(ACL)。不同云厂商对ACL的支持和实现方式有所不同, + // 因此根据具体的云服务提供商,你可能需要进行不同的配置(自行开启,阿里云有acl权限配置,腾讯云没有acl权限配置) + //.acl(getAccessPolicy().getObjectCannedACL()) .build()) .build());