fix 修复 minio 特殊配置导致其他 oss 出现的问题

feature/model
疯狂的狮子Li 2 years ago
parent 1f41b1db02
commit 24be022d4c

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

Loading…
Cancel
Save