Skip to content

Commit 214d0f6

Browse files
committed
判断是否使用提供的cos endpoint地址
1 parent fa20631 commit 214d0f6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/org/elasticsearch/repositories/cos/COSService.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.qcloud.cos.region.Region;
88
import org.elasticsearch.ElasticsearchException;
99
import org.elasticsearch.cluster.metadata.RepositoryMetaData;
10+
import org.elasticsearch.common.Strings;
1011
import org.elasticsearch.common.component.AbstractLifecycleComponent;
1112
import org.elasticsearch.common.settings.Settings;
1213
import org.elasticsearch.common.unit.ByteSizeUnit;
@@ -32,7 +33,9 @@ private synchronized COSClient createClient(RepositoryMetaData metaData) {
3233

3334
COSCredentials cred = new BasicCOSCredentials(access_key_id, access_key_secret);
3435
ClientConfig clientConfig = new ClientConfig(new Region(region));
35-
clientConfig.setEndPointSuffix(endPoint);
36+
if (Strings.hasLength(endPoint)) {
37+
clientConfig.setEndPointSuffix(endPoint);
38+
}
3639
COSClient client = new COSClient(cred, clientConfig);
3740

3841
return client;

0 commit comments

Comments
 (0)