diff --git a/ruoyi-oss/src/main/java/com/ruoyi/oss/core/OssClient.java b/ruoyi-oss/src/main/java/com/ruoyi/oss/core/OssClient.java index f0776dc3..15833d3c 100644 --- a/ruoyi-oss/src/main/java/com/ruoyi/oss/core/OssClient.java +++ b/ruoyi-oss/src/main/java/com/ruoyi/oss/core/OssClient.java @@ -10,6 +10,7 @@ import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.client.builder.AwsClientBuilder; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3Client; +import com.amazonaws.services.s3.AmazonS3ClientBuilder; import com.amazonaws.services.s3.model.*; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.StringUtils; @@ -51,14 +52,16 @@ public class OssClient { } else { clientConfig.setProtocol(Protocol.HTTP); } - this.client = AmazonS3Client.builder() + AmazonS3ClientBuilder build = AmazonS3Client.builder() .withEndpointConfiguration(endpointConfig) .withClientConfiguration(clientConfig) .withCredentials(credentialsProvider) - .disableChunkedEncoding() - // https限制使用域名访问 需要此配置 站点填域名 - .enablePathStyleAccess() - .build(); + .disableChunkedEncoding(); + if (!StringUtils.containsAny(properties.getEndpoint(), OssConstant.CLOUD_SERVICE)){ + // minio 使用https限制使用域名访问 需要此配置 站点填域名 + build.enablePathStyleAccess(); + } + this.client = build.build(); createBucket(); } catch (Exception e) {